aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-11-07 06:13:24 -0500
committerPaul Mundt <lethal@linux-sh.org>2007-11-07 06:13:24 -0500
commit0ac554b9be9fd340aa59e0d6a311986afcea40cf (patch)
tree404f2eb2dc2482dbde88b814e9f44462816f1d1c /drivers/rtc
parent29dd0dae507f73f305aaea765f975eafd1fa5493 (diff)
rtc: rtc-sh: Zero out tm value for invalid rtc states.
Follows the changes of some of the other RTC drivers. If the tm value is bogus, just zero it out. Adds some sanity for RTC_RD_TIME. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sh.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 61caed506c31..8e8c8b8e81ee 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -351,8 +351,10 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
351 tm->tm_sec, tm->tm_min, tm->tm_hour, 351 tm->tm_sec, tm->tm_min, tm->tm_hour,
352 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); 352 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
353 353
354 if (rtc_valid_tm(tm) < 0) 354 if (rtc_valid_tm(tm) < 0) {
355 dev_err(dev, "invalid date\n"); 355 dev_err(dev, "invalid date\n");
356 rtc_time_to_tm(0, tm);
357 }
356 358
357 return 0; 359 return 0;
358} 360}