qlogicpti: Return correct error code
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Wed, 17 Feb 2016 13:32:54 +0000 (19:02 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 2 Mar 2016 01:06:49 +0000 (20:06 -0500)
The return value of of_ioremap on failure should be -ENODEV and not
-1.

Found using Coccinelle. A simplified version of the semantic patch
used is:

//<smpl>
@@
expression *e;
@@

e = of_ioremap(...);
if (e == NULL) {
...
return
- -1
+ -ENODEV
;
}
//</smpl>

The single call site only checks that the return value is less than 0,
hence no change is required at the call site.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qlogicpti.c

index 676385ff28efb0d4dfc392f8dddf7a2c54c32aef..69bfc0a1aea30f99319ad50c6ecaec0649cf8862 100644 (file)
@@ -710,7 +710,7 @@ static int qpti_map_regs(struct qlogicpti *qpti)
                                 "PTI Qlogic/ISP");
        if (!qpti->qregs) {
                printk("PTI: Qlogic/ISP registers are unmappable\n");
-               return -1;
+               return -ENODEV;
        }
        if (qpti->is_pti) {
                qpti->sreg = of_ioremap(&op->resource[0], (16 * 4096),
@@ -718,7 +718,7 @@ static int qpti_map_regs(struct qlogicpti *qpti)
                                        "PTI Qlogic/ISP statreg");
                if (!qpti->sreg) {
                        printk("PTI: Qlogic/ISP status register is unmappable\n");
-                       return -1;
+                       return -ENODEV;
                }
        }
        return 0;