[PATCH] rtc: pcf8523: fix ptr_ret.cocci warnings

From: kbuild test robot
Date: Mon Dec 16 2019 - 18:04:53 EST


From: kbuild test robot <lkp@xxxxxxxxx>

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


Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 93966243cf90 ("rtc: pcf8523: Remove struct pcf8523")
CC: Nobuhiro Iwamatsu <iwamatsu@xxxxxxxxxxx>
Signed-off-by: kbuild test robot <lkp@xxxxxxxxx>
---

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d1eef1c619749b2a57e514a3fa67d9a516ffa919
commit: 93966243cf90c055d89b5ebfbb8dee0f9ac6b0a2 rtc: pcf8523: Remove struct pcf8523

rtc-pcf8523.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -358,10 +358,7 @@ static int pcf8523_probe(struct i2c_clie

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[] = {