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

Checking 'rtc->irq < 0' doesn't work because 'rtc->irq' is unsigned.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
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) {
-- 
1.7.3.4

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 16:12 Nicolas Kaiser [this message]
2011-03-30 16:37 ` [PATCH] drivers/rtc/rtc-jz4740.c: fix error check Lars-Peter Clausen
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=20110330181201.29e473bf@absol.kitzblitz \
    --to=nikai@nikai.net \
    --cc=a.zummo@towertech.it \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --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