Skip to content

Commit

Permalink
rtc: rtc-sh: Zero out tm value for invalid rtc states.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mundt committed Nov 7, 2007
1 parent 29dd0da commit 0ac554b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/rtc/rtc-sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0ac554b

Please sign in to comment.