diff mbox series

rtc: rzn1: fix inconsistent IS_ERR and PTR_ERR

Message ID 20220523015725.198244-1-william.xuanziyang@huawei.com (mailing list archive)
State Mainlined
Commit 0b6da785130d9e8cf33d001a7bf08a979c87d019
Delegated to: Geert Uytterhoeven
Headers show
Series rtc: rzn1: fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Ziyang Xuan (William) May 23, 2022, 1:57 a.m. UTC
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(-)

Comments

Miquel Raynal May 23, 2022, 7:58 a.m. UTC | #1
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
diff mbox series

Patch

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;