* [PATCH] drivers/rtc/rtc-jz4740.c: fix error check
@ 2011-03-30 16:12 Nicolas Kaiser
2011-03-30 16:37 ` Lars-Peter Clausen
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Kaiser @ 2011-03-30 16:12 UTC (permalink / raw)
To: Alessandro Zummo; +Cc: Lars-Peter Clausen, rtc-linux, linux-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/rtc/rtc-jz4740.c: fix error check
2011-03-30 16:12 [PATCH] drivers/rtc/rtc-jz4740.c: fix error check Nicolas Kaiser
@ 2011-03-30 16:37 ` Lars-Peter Clausen
2011-03-30 18:27 ` [PATCH] drivers/rtc/rtc-jz4740.c: fix error check v2 Nicolas Kaiser
0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2011-03-30 16:37 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Alessandro Zummo, rtc-linux, linux-kernel
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) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] drivers/rtc/rtc-jz4740.c: fix error check v2
2011-03-30 16:37 ` Lars-Peter Clausen
@ 2011-03-30 18:27 ` Nicolas Kaiser
2011-03-31 14:59 ` [rtc-linux] " Wan ZongShun
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Kaiser @ 2011-03-30 18:27 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: Alessandro Zummo, rtc-linux, linux-kernel
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;
rtc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!rtc->mem) {
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [rtc-linux] [PATCH] drivers/rtc/rtc-jz4740.c: fix error check v2
2011-03-30 18:27 ` [PATCH] drivers/rtc/rtc-jz4740.c: fix error check v2 Nicolas Kaiser
@ 2011-03-31 14:59 ` Wan ZongShun
0 siblings, 0 replies; 4+ messages in thread
From: Wan ZongShun @ 2011-03-31 14:59 UTC (permalink / raw)
To: rtc-linux, Andrew Morton
Cc: Nicolas Kaiser, Lars-Peter Clausen, Alessandro Zummo,
linux-kernel
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.
--
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-31 14:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 16:12 [PATCH] drivers/rtc/rtc-jz4740.c: fix error check Nicolas Kaiser
2011-03-30 16:37 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox