diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2019-03-20 06:32:14 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-03-20 06:37:50 -0400 |
commit | 15d82d22498784966df8e4696174a16b02cc1052 (patch) | |
tree | 5248add5b2dae5f08ea9028b380e72fb537bffa9 | |
parent | d6752e185c3168771787a02dc6a55f32260943cc (diff) |
rtc: sh: Fix invalid alarm warning for non-enabled alarm
When no alarm has been programmed on RSK-RZA1, an error message is
printed during boot:
rtc rtc0: invalid alarm value: 2019-03-14T255:255:255
sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm
field that is not enabled. __rtc_read_alarm() validates the received
alarm values, and fills in missing fields when needed.
While 0xff is handled fine for the year, month, and day fields, and
corrected as considered being out-of-range, this is not the case for the
hour, minute, and second fields, where -1 is expected for missing
fields.
Fix this by returning -1 instead, as this value is handled fine for all
fields.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | drivers/rtc/rtc-sh.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index d417b203cbc5..1d3de2a3d1a4 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -374,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
374 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) | 374 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) |
375 | { | 375 | { |
376 | unsigned int byte; | 376 | unsigned int byte; |
377 | int value = 0xff; /* return 0xff for ignored values */ | 377 | int value = -1; /* return -1 for ignored values */ |
378 | 378 | ||
379 | byte = readb(rtc->regbase + reg_off); | 379 | byte = readb(rtc->regbase + reg_off); |
380 | if (byte & AR_ENB) { | 380 | if (byte & AR_ENB) { |