]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/rtc/rtc-r9701.c: check that r9701_set_datetime() succeeded
authorAndrew Morton <akpm@linux-foundation.org>
Sat, 21 Jul 2012 00:55:04 +0000 (10:55 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 03:53:24 +0000 (13:53 +1000)
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 <devendra.aaru@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Andreas Dumberger <andreas.dumberger@tqs.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/rtc/rtc-r9701.c

index e6c34c02470623a838e35bdf8d412a9455355e85..2c183ebff715f7acc277a82558544af53083ef4b 100644 (file)
@@ -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;
                }