From: Hannes Reinecke <hare@suse.de>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
JBottomley@odin.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] qlogicpti: Return correct error code
Date: Tue, 1 Mar 2016 19:59:17 +0800 [thread overview]
Message-ID: <56D58415.5090407@suse.de> (raw)
In-Reply-To: <20160217133254.GA31334@amitoj-Inspiron-3542>
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@gmail.com>
> ---
> 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@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +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)
next prev parent reply other threads:[~2016-03-01 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 13:32 [PATCH] qlogicpti: Return correct error code Amitoj Kaur Chawla
2016-03-01 5:53 ` Seymour, Shane M
2016-03-01 11:59 ` Hannes Reinecke [this message]
2016-03-02 1:08 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56D58415.5090407@suse.de \
--to=hare@suse.de \
--cc=JBottomley@odin.com \
--cc=amitoj1606@gmail.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.