]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: wilco-ec: Handle reading invalid times
authorNick Crews <ncrews@chromium.org>
Fri, 4 Oct 2019 14:26:08 +0000 (08:26 -0600)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 14 Oct 2019 15:49:17 +0000 (17:49 +0200)
commit6535b6b81dd8458a35b79a5b406988b6f0ba5fa6
tree617da4fb8a41edf387b1774620ca9dc945d12e9e
parent47dd9e34189592d2be5eec1001e33d28a664719d
rtc: wilco-ec: Handle reading invalid times

If the RTC HW returns an invalid time, the rtc_year_days()
call would crash. This patch adds error logging in this
situation, and removes the tm_yday and tm_wday calculations.
These fields should not be relied upon by userspace
according to man rtc, and thus we don't need to calculate
them.

Signed-off-by: Nick Crews <ncrews@chromium.org>
Reviewed-by: Daniel Campello <campello@chromium.org>
Link: https://lore.kernel.org/r/20191004142608.170159-1-ncrews@chromium.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-wilco-ec.c