From: Paul Mundt Date: Wed, 7 Nov 2007 11:13:24 +0000 (+0900) Subject: rtc: rtc-sh: Zero out tm value for invalid rtc states. X-Git-Tag: v2.6.24-rc3~171^2~5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0ac554b9be9fd340aa59e0d6a311986afcea40cf;p=karo-tx-linux.git 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 --- 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) tm->tm_sec, tm->tm_min, tm->tm_hour, 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"); + rtc_time_to_tm(0, tm); + } return 0; }