summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2018-11-07 03:39:51 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-11-14 10:44:34 +0100
commitf1bd154d8838f9bddbe0f07292dd1c70a47c8b83 (patch)
tree8b1028f7ef09446f72125af0be398992594f765e
parentrtc: m41t80: Correct alarm month range with RTC reads (diff)
downloadlinux-f1bd154d8838f9bddbe0f07292dd1c70a47c8b83.tar.xz
linux-f1bd154d8838f9bddbe0f07292dd1c70a47c8b83.zip
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.c13
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)
sizeof(buf), buf);
if (err < 0) {
dev_err(&client->dev, "Unable to read date\n");
- return -EIO;
+ return err;
}
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)
if (flags < 0)
return flags;
- if (i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS,
- flags & ~M41T80_FLAGS_OF)) {
+ err = i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS,
+ flags & ~M41T80_FLAGS_OF);
+ if (err < 0) {
dev_err(&client->dev, "Unable to write flags register\n");
- return -EIO;
+ return err;
}
return err;
@@ -287,10 +288,12 @@ static int m41t80_rtc_proc(struct device *dev, struct seq_file *seq)
{
struct i2c_client *client = to_i2c_client(dev);
struct m41t80_data *clientdata = i2c_get_clientdata(client);
- u8 reg;
+ int reg;
if (clientdata->features & M41T80_FEATURE_BL) {
reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS);
+ if (reg < 0)
+ return reg;
seq_printf(seq, "battery\t\t: %s\n",
(reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok");
}