diff mbox series

[v2] rtc: pcf2127: add error checking when disabling POR0

Message ID 20230515182347.2939997-1-hugo@hugovil.com
State Superseded
Headers show
Series [v2] rtc: pcf2127: add error checking when disabling POR0 | expand

Commit Message

Hugo Villeneuve May 15, 2023, 6:23 p.m. UTC
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

If PCF2127 device is absent from the I2C bus, or if there is a
communication problem, disabling POR0 may fail silently and we
still continue with probing the device. In that case, abort probe
operation.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
V1 -> V2: Removed error message

 drivers/rtc/rtc-pcf2127.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


base-commit: e99ab4abebf825de2ce65f6c6c32ee30e00bb077
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 87f4fc9df68b..d9d3ef373c03 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -703,8 +703,10 @@  static int pcf2127_probe(struct device *dev, struct regmap *regmap,
 	 * The "Power-On Reset Override" facility prevents the RTC to do a reset
 	 * after power on. For normal operation the PORO must be disabled.
 	 */
-	regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
+	ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
 				PCF2127_BIT_CTRL1_POR_OVRD);
+	if (ret < 0)
+		return ret;
 
 	ret = regmap_read(pcf2127->regmap, PCF2127_REG_CLKOUT, &val);
 	if (ret < 0)