Skip to content

Commit a6d2414

Browse files
musicakcmartinkpetersen
authored andcommitted
qlogicpti: Return correct error code
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>
1 parent 8d5dbec commit a6d2414

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/qlogicpti.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,15 @@ static int qpti_map_regs(struct qlogicpti *qpti)
710710
"PTI Qlogic/ISP");
711711
if (!qpti->qregs) {
712712
printk("PTI: Qlogic/ISP registers are unmappable\n");
713-
return -1;
713+
return -ENODEV;
714714
}
715715
if (qpti->is_pti) {
716716
qpti->sreg = of_ioremap(&op->resource[0], (16 * 4096),
717717
sizeof(unsigned char),
718718
"PTI Qlogic/ISP statreg");
719719
if (!qpti->sreg) {
720720
printk("PTI: Qlogic/ISP status register is unmappable\n");
721-
return -1;
721+
return -ENODEV;
722722
}
723723
}
724724
return 0;

0 commit comments

Comments
 (0)