Skip to content

Commit e4163fc

Browse files
hvilleneuvedooalexandrebelloni
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 4e5eb7e commit e4163fc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/rtc/rtc-pcf2127.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,10 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
11921192
* The "Power-On Reset Override" facility prevents the RTC to do a reset
11931193
* after power on. For normal operation the PORO must be disabled.
11941194
*/
1195-
regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
1195+
ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
11961196
PCF2127_BIT_CTRL1_POR_OVRD);
1197+
if (ret < 0)
1198+
return ret;
11971199

11981200
ret = regmap_read(pcf2127->regmap, pcf2127->cfg->reg_clkout, &val);
11991201
if (ret < 0)

0 commit comments

Comments
 (0)