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>
Wed, 19 Jun 2019 06:18:07 +0000 (08:18 +0200)
commit90fc261d509ea9a0314a2b4973d3e9622b34db2b
treed303a393879d2cebe73d3824e8928c7b2c5e7c0b
parent04757d0e37897cdfa59050157b9083d661bd099e
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