From: Andrew Morton Date: Sat, 21 Jul 2012 00:55:04 +0000 (+1000) Subject: drivers/rtc/rtc-r9701.c: check that r9701_set_datetime() succeeded X-Git-Tag: next-20120725~1^2~47 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ab5ff933ab2c372e76d6fc5e09fe287a7f3504aa;p=karo-tx-linux.git drivers/rtc/rtc-r9701.c: check that r9701_set_datetime() succeeded When the driver detects that the clock time is invalid, it attempts to write a sane time into the hardware. We curently assume that everything is OK is those writes succeeded. But it is better to re-read the time from the hardware to ensure that the new settings got there OK. Cc: Devendra Naga Cc: Alessandro Zummo Cc: Anatolij Gustschin Cc: Andreas Dumberger Signed-off-by: Andrew Morton --- diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index e6c34c024706..2c183ebff715 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c @@ -147,7 +147,8 @@ static int __devinit r9701_probe(struct spi_device *spi) dt.tm_mon = 0; dt.tm_year = 100; - if (r9701_set_datetime(&spi->dev, &dt)) { + if (r9701_set_datetime(&spi->dev, &dt) || + r9701_get_datetime(&spi->dev, &dt)) { dev_err(&spi->dev, "cannot repair RTC register\n"); return -ENODEV; }