Browse Source

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>
Paul Mundt 17 years ago
parent
commit
0ac554b9be
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/rtc/rtc-sh.c

+ 3 - 1
drivers/rtc/rtc-sh.c

@@ -351,8 +351,10 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
 		tm->tm_sec, tm->tm_min, tm->tm_hour,
 		tm->tm_sec, tm->tm_min, tm->tm_hour,
 		tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
 		tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
 
 
-	if (rtc_valid_tm(tm) < 0)
+	if (rtc_valid_tm(tm) < 0) {
 		dev_err(dev, "invalid date\n");
 		dev_err(dev, "invalid date\n");
+		rtc_time_to_tm(0, tm);
+	}
 
 
 	return 0;
 	return 0;
 }
 }