Patchwork drivers/rtc/rtc-jz4740.c: fix error check v2

login
register
mail settings
Submitter Nicolas Kaiser
Date March 30, 2011, 6:27 p.m.
Message ID <20110330202700.7d8142e8@absol.kitzblitz>
Download mbox | patch
Permalink /patch/88950/
State New
Headers show

Comments

Nicolas Kaiser - March 30, 2011, 6:27 p.m.
Checking 'rtc->irq < 0' doesn't work because 'rtc->irq' is unsigned.

v2: return error code from platform_get_irq() instead of -ENOENT.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 drivers/rtc/rtc-jz4740.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Wan ZongShun - March 31, 2011, 2:59 p.m.
2011/3/31 Nicolas Kaiser <nikai@nikai.net>:
> Checking 'rtc->irq < 0' doesn't work because 'rtc->irq' is unsigned.
>
> v2: return error code from platform_get_irq() instead of -ENOENT.
>
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
>  drivers/rtc/rtc-jz4740.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index b647363..efd9691 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -220,12 +220,12 @@ 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 = -ENOENT;
> +       ret = platform_get_irq(pdev, 0);
> +       if (ret < 0) {
>                dev_err(&pdev->dev, "Failed to get platform irq\n");
>                goto err_free;
>        }
> +       rtc->irq = ret;
>

This patch looks good to me.

Acked-by: Wan ZongShun <mcuos.com@gmail.com>

>        rtc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>        if (!rtc->mem) {
> --
> 1.7.3.4
>
> --
> You received this message because you are subscribed to "rtc-linux".
> Membership options at http://groups.google.com/group/rtc-linux .
> Please read http://groups.google.com/group/rtc-linux/web/checklist
> before submitting a driver.

Patch

diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index b647363..efd9691 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -220,12 +220,12 @@  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 = -ENOENT;
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0) {
 		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) {