linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dan.carpenter@oracle.com (Dan Carpenter)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch] char: xilinx_hwicap: missing error code if ioremap() fails
Date: Tue, 17 Jun 2014 09:03:24 +0300	[thread overview]
Message-ID: <20140617060324.GS5015@mwanda> (raw)
In-Reply-To: <add7f4d9-0279-4c49-b936-d70f34008ab4@BY2FFO11FD044.protection.gbl>

On Tue, Jun 17, 2014 at 02:53:27AM +0200, Michal Simek wrote:
> On 06/11/2014 08:40 AM, Jingoo Han wrote:
> > On Wednesday, June 11, 2014 3:05 PM, Dan Carpenter wrote:
> >>
> >> Return -ENOMEM instead of success if ioremap() fails.
> >>
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Reviewed-by: Jingoo Han <jg1.han@samsung.com>
> > 
> > Best regards,
> > Jingoo Han
> > 
> >> ---
> >> Static checker stuff, I can't compile this.
> >>
> >> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> index f6345f9..9b1a5ac 100644
> >> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> >> @@ -661,6 +661,7 @@ static int hwicap_setup(struct device *dev, int id,
> >>  	drvdata->base_address = ioremap(drvdata->mem_start, drvdata->mem_size);
> >>  	if (!drvdata->base_address) {
> >>  		dev_err(dev, "ioremap() failed\n");
> >> +		retval = -ENOMEM;
> 
> Isn't it just better to do?
> 
> if (IS_ERR(drvdata->base_address)) {
> 	...
> 	retval = PTR_ERR(drvdata->base_address);
> }

ioremap() returns NULL on error, not an ERR_PTR.

regards,
dan carpenter

  reply	other threads:[~2014-06-17  6:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11  6:04 [patch] char: xilinx_hwicap: missing error code if ioremap() fails Dan Carpenter
2014-06-11  6:40 ` Jingoo Han
2014-06-17  0:53   ` Michal Simek
2014-06-17  6:03     ` Dan Carpenter [this message]
2014-06-17 22:11       ` Michal Simek

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=20140617060324.GS5015@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).