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)
commit9aa0d0be3856749c3be08089fe12a1f4494a030b
tree617da4fb8a41edf387b1774620ca9dc945d12e9e
parent147dae76dbb9b20ba48385911c6fc04bf038a64a
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