Skip to content

Commit

Permalink
drivers/rtc/rtc-r9701.c: check that r9701_set_datetime() succeeded
Browse files Browse the repository at this point in the history
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 if 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 <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Anatolij Gustschin <[email protected]>
Cc: Andreas Dumberger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
akpm00 authored and torvalds committed Jul 31, 2012
1 parent aa11ec5 commit 8e74b6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/rtc/rtc-r9701.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8e74b6e

Please sign in to comment.