From: Amitoj Kaur Chawla Date: Wed, 17 Feb 2016 13:32:54 +0000 (+0530) Subject: qlogicpti: Return correct error code X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a6d24143fca421c836f78538705c8e5b3ef04e3d;p=linux-beck.git 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: // @@ expression *e; @@ e = of_ioremap(...); if (e == NULL) { ... return - -1 + -ENODEV ; } // 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 Reviewed-by: Shane Seymour Reviewed-by: Hannes Reinicke Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 676385ff28ef..69bfc0a1aea3 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -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;