* [PATCH] rtc: rzn1: Fix inconsistent IS_ERR and PTR_ERR
@ 2022-05-24 6:09 Haowen Bai
2022-05-24 7:19 ` Miquel Raynal
0 siblings, 1 reply; 4+ messages in thread
From: Haowen Bai @ 2022-05-24 6:09 UTC (permalink / raw)
To: Miquel Raynal, Alessandro Zummo, Alexandre Belloni, Michel Pollet
Cc: Haowen Bai, linux-rtc, linux-renesas-soc, linux-kernel
The proper pointer to be passed as argument is rtc->rtcdev.
Detected using Coccinelle.
Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
drivers/rtc/rtc-rzn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index f92d1398b0f1..4cf54af8a8c3 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -348,7 +348,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtcdev))
- return PTR_ERR(rtc);
+ return PTR_ERR(rtc->rtcdev);
rtc->rtcdev->range_min = RTC_TIMESTAMP_BEGIN_2000;
rtc->rtcdev->range_max = RTC_TIMESTAMP_END_2099;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rtc: rzn1: Fix inconsistent IS_ERR and PTR_ERR
2022-05-24 6:09 [PATCH] rtc: rzn1: Fix inconsistent IS_ERR and PTR_ERR Haowen Bai
@ 2022-05-24 7:19 ` Miquel Raynal
0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2022-05-24 7:19 UTC (permalink / raw)
To: Haowen Bai
Cc: Alessandro Zummo, Alexandre Belloni, Michel Pollet, linux-rtc,
linux-renesas-soc, linux-kernel
Hi Haowen,
baihaowen@meizu.com wrote on Tue, 24 May 2022 14:09:45 +0800:
> The proper pointer to be passed as argument is rtc->rtcdev.
> Detected using Coccinelle.
>
> Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
Thanks for your patch. This has already been reported twice,
Alexandre will likely apply one of the fixes after the merge window.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
> drivers/rtc/rtc-rzn1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index f92d1398b0f1..4cf54af8a8c3 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -348,7 +348,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
>
> rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
> if (IS_ERR(rtc->rtcdev))
> - return PTR_ERR(rtc);
> + return PTR_ERR(rtc->rtcdev);
>
> rtc->rtcdev->range_min = RTC_TIMESTAMP_BEGIN_2000;
> rtc->rtcdev->range_max = RTC_TIMESTAMP_END_2099;
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] rtc: rzn1: fix inconsistent IS_ERR and PTR_ERR
@ 2022-05-23 1:57 Ziyang Xuan
2022-05-23 7:58 ` Miquel Raynal
0 siblings, 1 reply; 4+ messages in thread
From: Ziyang Xuan @ 2022-05-23 1:57 UTC (permalink / raw)
To: miquel.raynal, a.zummo, alexandre.belloni, linux-rtc,
linux-renesas-soc
Cc: william.xuanziyang
It is inconsistent IS_ERR and PTR_ERR for rtc->rtcdev in rzn1_rtc_probe().
Generated by coccinelle script:
scripts/coccinelle/tests/odd_ptr_err.cocci
Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
drivers/rtc/rtc-rzn1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
index f92d1398b0f1..4cf54af8a8c3 100644
--- a/drivers/rtc/rtc-rzn1.c
+++ b/drivers/rtc/rtc-rzn1.c
@@ -348,7 +348,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtcdev))
- return PTR_ERR(rtc);
+ return PTR_ERR(rtc->rtcdev);
rtc->rtcdev->range_min = RTC_TIMESTAMP_BEGIN_2000;
rtc->rtcdev->range_max = RTC_TIMESTAMP_END_2099;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rtc: rzn1: fix inconsistent IS_ERR and PTR_ERR
2022-05-23 1:57 [PATCH] rtc: rzn1: fix " Ziyang Xuan
@ 2022-05-23 7:58 ` Miquel Raynal
0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2022-05-23 7:58 UTC (permalink / raw)
To: Ziyang Xuan; +Cc: a.zummo, alexandre.belloni, linux-rtc, linux-renesas-soc
Hi Ziyang,
william.xuanziyang@huawei.com wrote on Mon, 23 May 2022 09:57:25 +0800:
> It is inconsistent IS_ERR and PTR_ERR for rtc->rtcdev in rzn1_rtc_probe().
>
> Generated by coccinelle script:
> scripts/coccinelle/tests/odd_ptr_err.cocci
>
> Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> ---
> drivers/rtc/rtc-rzn1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index f92d1398b0f1..4cf54af8a8c3 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -348,7 +348,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
>
> rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
> if (IS_ERR(rtc->rtcdev))
> - return PTR_ERR(rtc);
> + return PTR_ERR(rtc->rtcdev);
Thanks for the patch, but Dan Carpenter already provided the exact same
fix.
Cheers,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-24 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24 6:09 [PATCH] rtc: rzn1: Fix inconsistent IS_ERR and PTR_ERR Haowen Bai
2022-05-24 7:19 ` Miquel Raynal
-- strict thread matches above, loose matches on Subject: below --
2022-05-23 1:57 [PATCH] rtc: rzn1: fix " Ziyang Xuan
2022-05-23 7:58 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).