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:21:00 +0000 (08:21 +0200)
commit3177ab541ba8b875d0cdb85e9813f5402e59714d
treefa353c3724df3f32ee97bf324d7f8d42ce712e5c
parent488beeebddaf563aed96c27aa78c520a00f1a30f
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