public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Nicolas Kaiser <nikai@nikai.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/rtc/rtc-jz4740.c: fix error check
Date: Wed, 30 Mar 2011 18:37:42 +0200	[thread overview]
Message-ID: <4D935C56.4060903@metafoo.de> (raw)
In-Reply-To: <20110330181201.29e473bf@absol.kitzblitz>

On 03/30/2011 06:12 PM, Nicolas Kaiser wrote:
> Checking 'rtc->irq < 0' doesn't work because 'rtc->irq' is unsigned.
> 
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>

But while were at it we should change it, so that the result of
platform_get_irq becomes the return value in case of an error instead of using
the wrong or at least confusing -ENOENT.

> ---
> Untested.
> 
>  drivers/rtc/rtc-jz4740.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index b647363..ba91bc6 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -220,12 +220,13 @@ static int __devinit jz4740_rtc_probe(struct platform_device *pdev)
>  	if (!rtc)
>  		return -ENOMEM;
>  
> -	rtc->irq = platform_get_irq(pdev, 0);
> -	if (rtc->irq < 0) {
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0) {
>  		ret = -ENOENT;
>  		dev_err(&pdev->dev, "Failed to get platform irq\n");
>  		goto err_free;
>  	}
> +	rtc->irq = ret;
>  
>  	rtc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!rtc->mem) {


  reply	other threads:[~2011-03-30 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 16:12 [PATCH] drivers/rtc/rtc-jz4740.c: fix error check Nicolas Kaiser
2011-03-30 16:37 ` Lars-Peter Clausen [this message]
2011-03-30 18:27   ` [PATCH] drivers/rtc/rtc-jz4740.c: fix error check v2 Nicolas Kaiser
2011-03-31 14:59     ` [rtc-linux] " Wan ZongShun

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=4D935C56.4060903@metafoo.de \
    --to=lars@metafoo.de \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikai@nikai.net \
    --cc=rtc-linux@googlegroups.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox