diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2018-11-06 21:39:51 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-11-14 04:44:34 -0500 |
commit | f1bd154d8838f9bddbe0f07292dd1c70a47c8b83 (patch) | |
tree | 8b1028f7ef09446f72125af0be398992594f765e | |
parent | 3cc9ffbb1f51eb4320575a48e4805a8f52e0e26b (diff) |
rtc: m41t80: Complete error propagation from SMBus calls
Complement commit 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate
error value from smbus functions") and correct the remaining places that
fail to propagate the error code from SMBus calls.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
References: 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate error value from smbus functions")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | drivers/rtc/rtc-m41t80.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 7431a795a624..a39138932379 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -217,7 +217,7 @@ static int m41t80_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
217 | sizeof(buf), buf); | 217 | sizeof(buf), buf); |
218 | if (err < 0) { | 218 | if (err < 0) { |
219 | dev_err(&client->dev, "Unable to read date\n"); | 219 | dev_err(&client->dev, "Unable to read date\n"); |
220 | return -EIO; | 220 | return err; |
221 | } | 221 | } |
222 | 222 | ||
223 | tm->tm_sec = bcd2bin(buf[M41T80_REG_SEC] & 0x7f); | 223 | tm->tm_sec = bcd2bin(buf[M41T80_REG_SEC] & 0x7f); |
@@ -274,10 +274,11 @@ static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
274 | if (flags < 0) | 274 | if (flags < 0) |
275 | return flags; | 275 | return flags; |
276 | 276 | ||
277 | if (i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS, | 277 | err = i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS, |
278 | flags & ~M41T80_FLAGS_OF)) { | 278 | flags & ~M41T80_FLAGS_OF); |
279 | if (err < 0) { | ||
279 | dev_err(&client->dev, "Unable to write flags register\n"); | 280 | dev_err(&client->dev, "Unable to write flags register\n"); |
280 | return -EIO; | 281 | return err; |
281 | } | 282 | } |
282 | 283 | ||
283 | return err; | 284 | return err; |
@@ -287,10 +288,12 @@ static int m41t80_rtc_proc(struct device *dev, struct seq_file *seq) | |||
287 | { | 288 | { |
288 | struct i2c_client *client = to_i2c_client(dev); | 289 | struct i2c_client *client = to_i2c_client(dev); |
289 | struct m41t80_data *clientdata = i2c_get_clientdata(client); | 290 | struct m41t80_data *clientdata = i2c_get_clientdata(client); |
290 | u8 reg; | 291 | int reg; |
291 | 292 | ||
292 | if (clientdata->features & M41T80_FEATURE_BL) { | 293 | if (clientdata->features & M41T80_FEATURE_BL) { |
293 | reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); | 294 | reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); |
295 | if (reg < 0) | ||
296 | return reg; | ||
294 | seq_printf(seq, "battery\t\t: %s\n", | 297 | seq_printf(seq, "battery\t\t: %s\n", |
295 | (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); | 298 | (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); |
296 | } | 299 | } |