Skip to content

Commit

Permalink
drivers/rtc/rtc-vt8500.c: fix year field in vt8500_rtc_set_time()
Browse files Browse the repository at this point in the history
The year field is incorrectly masked when setting the date.  If the year
is beyond 2099, the year field will be incorrectly updated in hardware.

This patch masks the year field correctly.

Signed-off-by: Edgar Toernig <[email protected]>
Signed-off-by: Tony Prisk <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
tonyprisk authored and torvalds committed Feb 5, 2013
1 parent 1363b56 commit 3bdf8cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/rtc/rtc-vt8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
return -EINVAL;
}

writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S)
writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S)
| (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
| (bin2bcd(tm->tm_mday))
| ((tm->tm_year >= 200) << DATE_CENTURY_S),
Expand Down

0 comments on commit 3bdf8cd

Please sign in to comment.