rtc: pcf8523: don't return invalid date when battery is low
authorBaruch Siach <baruch@tkos.co.il>
Wed, 5 Dec 2018 15:00:09 +0000 (17:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jun 2019 06:17:21 +0000 (08:17 +0200)
commit2eaaeb34fb17d3964b85febf1b7cf3b2eec947e1
tree1f9c40d15bb7a1c0c7b48b703d6cb390336f1b4d
parent4e528bed1c6e766dd97032cfc8d10260c9bda4d4
rtc: pcf8523: don't return invalid date when battery is low

commit ecb4a353d3afd45b9bb30c85d03ee113a0589079 upstream.

The RTC_VL_READ ioctl reports the low battery condition. Still,
pcf8523_rtc_read_time() happily returns invalid dates in this case.
Check the battery health on pcf8523_rtc_read_time() to avoid that.

Reported-by: Erik Čuk <erik.cuk@domel.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rtc/rtc-pcf8523.c