Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH -next] rtc: pcf8523: Use PTR_ERR_OR_ZERO() to simplify code
@ 2020-05-06  9:34 Samuel Zou
  2020-05-06  9:34 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Zou @ 2020-05-06  9:34 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Samuel Zou

Fixes coccicheck warning:

drivers/rtc/rtc-pcf8523.c:361:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
---
 drivers/rtc/rtc-pcf8523.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index 47e0f41..da8889a 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -358,10 +358,8 @@ static int pcf8523_probe(struct i2c_client *client,
 
 	rtc = devm_rtc_device_register(&client->dev, DRIVER_NAME,
 				       &pcf8523_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(rtc);
 }
 
 static const struct i2c_device_id pcf8523_id[] = {
-- 
2.6.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] rtc: pcf8523: Use PTR_ERR_OR_ZERO() to simplify code
  2020-05-06  9:34 [PATCH -next] rtc: pcf8523: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
@ 2020-05-06  9:34 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-05-06  9:34 UTC (permalink / raw)
  To: Samuel Zou; +Cc: a.zummo, linux-rtc, linux-kernel

Hi,

On 06/05/2020 17:34:00+0800, Samuel Zou wrote:
> Fixes coccicheck warning:
> 
> drivers/rtc/rtc-pcf8523.c:361:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 

I'm not taking this change because it is useless and will have to be
revert as soon as the probe function changes (and it will).

Does it really simplifies the code? I very much doubt so.

> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Samuel Zou <zou_wei@huawei.com>
> ---
>  drivers/rtc/rtc-pcf8523.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
> index 47e0f41..da8889a 100644
> --- a/drivers/rtc/rtc-pcf8523.c
> +++ b/drivers/rtc/rtc-pcf8523.c
> @@ -358,10 +358,8 @@ static int pcf8523_probe(struct i2c_client *client,
>  
>  	rtc = devm_rtc_device_register(&client->dev, DRIVER_NAME,
>  				       &pcf8523_rtc_ops, THIS_MODULE);
> -	if (IS_ERR(rtc))
> -		return PTR_ERR(rtc);
>  
> -	return 0;
> +	return PTR_ERR_OR_ZERO(rtc);
>  }
>  
>  static const struct i2c_device_id pcf8523_id[] = {
> -- 
> 2.6.2
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06  9:34 [PATCH -next] rtc: pcf8523: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
2020-05-06  9:34 ` Alexandre Belloni

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git