aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-pcf2127.c
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2023-07-28 13:12:12 -0400
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2023-08-17 01:01:24 +0200
commite4163fc59d088caf3250cc9c9862239a954d85b5 (patch)
tree720c09e1fa042fe1b328796061c01f4e0235189b /drivers/rtc/rtc-pcf2127.c
parent4e5eb7ef73c4c45e2e621eb51a76565153b63afe (diff)
downloadlinux-e4163fc59d088caf3250cc9c9862239a954d85b5.tar.gz
rtc: pcf2127: add error checking when disabling POR0
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> Link: https://lore.kernel.org/r/20230728171211.3016019-1-hugo@hugovil.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-pcf2127.c')
-rw-r--r--drivers/rtc/rtc-pcf2127.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 988cad1711746..f10bffc9e4871 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1192,8 +1192,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->cfg->reg_clkout, &val);
if (ret < 0)