diff options
-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 | } |