Skip to contentSkip to conversation

rtc: pcf8523: Use PTR_ERR_OR_ZERO

PATCH New Sudip Mukherjee 1 participant 1 message Nov 16, 2020 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: pcf8523: Use PTR_ERR_OR_ZERO

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'.

---
 drivers/rtc/rtc-pcf8523.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-pcf8523.c +1 -3
index 57d351dfe272..94f182599438 100644
@@ -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[] = {
Signature · 11 lines
2.11.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#171): https://lists.elisa.tech/g/linux-safety/message/171
Mute This Topic: https://lists.elisa.tech/mt/78296613/5278000
Group Owner: [email protected]
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-