Patchwork [3/6] drivers/rtc/rtc-tps65910.c: Fix incorrect return value on error

login
register
mail settings
Submitter Sachin Kamat
Date March 25, 2013, 10:45 a.m.
Message ID <1364208327-14207-4-git-send-email-sachin.kamat@linaro.org>
Download mbox | patch
Permalink /patch/230618/
State New
Headers show

Comments

Sachin Kamat - March 25, 2013, 10:45 a.m.
'ret' was not initialized to correct error value before
returning. Since 'irq' is also being tested for 0, we cannot
return irq itself as it means function is success even though we
are returning before completing the probe.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Venu Byravarasu <vbyravarasu@nvidia.com>
---
 drivers/rtc/rtc-tps65910.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Venu Byravarasu - March 25, 2013, 12:02 p.m.
> -----Original Message-----
> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
> Sent: Monday, March 25, 2013 4:15 PM
> To: rtc-linux@googlegroups.com
> Cc: a.zummo@towertech.it; akpm@linux-foundation.org;
> sachin.kamat@linaro.org; patches@linaro.org; Venu Byravarasu
> Subject: [PATCH 3/6] drivers/rtc/rtc-tps65910.c: Fix incorrect return value on
> error
> 
> 'ret' was not initialized to correct error value before
> returning. Since 'irq' is also being tested for 0, we cannot
> return irq itself as it means function is success even though we
> are returning before completing the probe.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Venu Byravarasu <vbyravarasu@nvidia.com>
> ---
>  drivers/rtc/rtc-tps65910.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
> index 26b8bd2..a9caf04 100644
> --- a/drivers/rtc/rtc-tps65910.c
> +++ b/drivers/rtc/rtc-tps65910.c
> @@ -263,7 +263,7 @@ static int tps65910_rtc_probe(struct platform_device
> *pdev)
>  	if (irq <= 0) {
>  		dev_warn(&pdev->dev, "Wake up is not possible as irq =
> %d\n",
>  			irq);
> -		return ret;
> +		return -ENXIO;

Acked-by:  Venu Byravarasu <vbyravarasu@nvidia.com>

Thanks,
Venu

>  	}
> 
>  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> --
> 1.7.4.1

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Patch

diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 26b8bd2..a9caf04 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -263,7 +263,7 @@  static int tps65910_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0) {
 		dev_warn(&pdev->dev, "Wake up is not possible as irq = %d\n",
 			irq);
-		return ret;
+		return -ENXIO;
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,