diff options
Diffstat (limited to 'drivers/rtc/rtc-r9701.c')
-rw-r--r-- | drivers/rtc/rtc-r9701.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 33b6ba0afa0d..2c183ebff715 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -138,8 +138,7 @@ static int __devinit r9701_probe(struct spi_device *spi) | |||
138 | * contain invalid values. If so, try to write a default date: | 138 | * contain invalid values. If so, try to write a default date: |
139 | * 2000/1/1 00:00:00 | 139 | * 2000/1/1 00:00:00 |
140 | */ | 140 | */ |
141 | r9701_get_datetime(&spi->dev, &dt); | 141 | if (r9701_get_datetime(&spi->dev, &dt)) { |
142 | if (rtc_valid_tm(&dt)) { | ||
143 | dev_info(&spi->dev, "trying to repair invalid date/time\n"); | 142 | dev_info(&spi->dev, "trying to repair invalid date/time\n"); |
144 | dt.tm_sec = 0; | 143 | dt.tm_sec = 0; |
145 | dt.tm_min = 0; | 144 | dt.tm_min = 0; |
@@ -148,7 +147,8 @@ static int __devinit r9701_probe(struct spi_device *spi) | |||
148 | dt.tm_mon = 0; | 147 | dt.tm_mon = 0; |
149 | dt.tm_year = 100; | 148 | dt.tm_year = 100; |
150 | 149 | ||
151 | if (r9701_set_datetime(&spi->dev, &dt)) { | 150 | if (r9701_set_datetime(&spi->dev, &dt) || |
151 | r9701_get_datetime(&spi->dev, &dt)) { | ||
152 | dev_err(&spi->dev, "cannot repair RTC register\n"); | 152 | dev_err(&spi->dev, "cannot repair RTC register\n"); |
153 | return -ENODEV; | 153 | return -ENODEV; |
154 | } | 154 | } |