Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amitoj Kaur Chawla and committed by
Martin K. Petersen
a6d24143 8d5dbec3

+2 -2
+2 -2
drivers/scsi/qlogicpti.c
··· 710 710 "PTI Qlogic/ISP"); 711 711 if (!qpti->qregs) { 712 712 printk("PTI: Qlogic/ISP registers are unmappable\n"); 713 - return -1; 713 + return -ENODEV; 714 714 } 715 715 if (qpti->is_pti) { 716 716 qpti->sreg = of_ioremap(&op->resource[0], (16 * 4096), ··· 718 718 "PTI Qlogic/ISP statreg"); 719 719 if (!qpti->sreg) { 720 720 printk("PTI: Qlogic/ISP status register is unmappable\n"); 721 - return -1; 721 + return -ENODEV; 722 722 } 723 723 } 724 724 return 0;