diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-05-17 23:33:30 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-05-17 23:43:22 +0300 |
commit | 6e6111f6c08dcc34c8bc3b3a2a4f944ceeaa78be (patch) | |
tree | 9309347eaa998fc7edb698d8c81ce14945a8b3e3 /drivers/rtc | |
parent | ed87c6d86d07dd345b2cd13f9be3794937165e04 (diff) | |
download | linux-6e6111f6c08dcc34c8bc3b3a2a4f944ceeaa78be.tar.xz |
rtc: rx8581: error out when time invalid
Return an error when the date is unreliable because the battery is low.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-rx8581.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c index 0a70f1ac5cc2..54631a3ab65f 100644 --- a/drivers/rtc/rtc-rx8581.c +++ b/drivers/rtc/rtc-rx8581.c @@ -109,6 +109,12 @@ static int rx8581_rtc_read_time(struct device *dev, struct rtc_time *tm) return -EIO; } + if (data & RX8581_FLAG_VLF) { + dev_warn(dev, + "low voltage detected, date/time is not reliable.\n"); + return -EINVAL; + } + do { /* If update flag set, clear it */ if (data & RX8581_FLAG_UF) { @@ -136,10 +142,6 @@ static int rx8581_rtc_read_time(struct device *dev, struct rtc_time *tm) } } while (data & RX8581_FLAG_UF); - if (data & RX8581_FLAG_VLF) - dev_info(dev, - "low voltage detected, date/time is not reliable.\n"); - dev_dbg(dev, "%s: raw data is sec=%02x, min=%02x, hr=%02x, " "wday=%02x, mday=%02x, mon=%02x, year=%02x\n", __func__, |