rtc: s35390a: make sure all members in the output are set
authorUwe Kleine-König <uwe@kleine-koenig.org>
Mon, 3 Apr 2017 21:32:38 +0000 (23:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:39 +0000 (14:04 +0200)
commit231b0f80d19c96a2083fc735a116882e8db92df5
treed83c8ca41b64c4404e9a2c33d54dc5b29a2b841e
parent1812b5cac00ba52bca38743bedca01ad3c08d338
rtc: s35390a: make sure all members in the output are set

commit ac4d4f65bbcba478309de36929016d2618421ba1 upstream.

The rtc core calls the .read_alarm with all fields initialized to 0. As
the s35390a driver doesn't touch some fields the returned date is
interpreted as a date in January 1900. So make sure all fields are set
to -1; some of them are then overwritten with the right data depending
on the hardware state.

In mainline this is done by commit d68778b80dd7 ("rtc: initialize output
parameter for read alarm to "uninitialized"") in the core. This is
considered to dangerous for stable as it might have side effects for
other rtc drivers that might for example rely on alarm->time.tm_sec
being initialized to 0.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/rtc/rtc-s35390a.c