Re: [PATCH] qlogicpti: Return correct error code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/17/2016 09:32 PM, Amitoj Kaur Chawla wrote:
> 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@xxxxxxxxx>
> ---
>  drivers/scsi/qlogicpti.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
> index 676385f..69bfc0a 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;
> 
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@xxxxxxx			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux