From 9701ecdee341640af59b5f97296c9e0f2aa60ca9 Mon Sep 17 00:00:00 2001 From: Chris Elston Date: Tue, 23 Dec 2008 13:57:10 -0800 Subject: [PATCH] --- yaml --- r: 120015 b: refs/heads/master c: cc6c2ca30074a0274c05dd3212c741a550f0d3c2 h: refs/heads/master i: 120013: 5363866bd0ab2739603e5352fbf7b1cea3a24bac 120011: 8fdb5c0d5113d06b0ce797680cba1b3f835b8855 120007: df08abbe8fa769f26f30ad46d9745977b9de72d2 119999: 161b27bd93f471f294c638cab2c8bb782ea91047 v: v3 --- [refs] | 2 +- trunk/drivers/rtc/rtc-isl1208.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 44c543dda9fc..6154527d8c3b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c47a75a45fa3a9d98b61f7e31983ffab2c44404f +refs/heads/master: cc6c2ca30074a0274c05dd3212c741a550f0d3c2 diff --git a/trunk/drivers/rtc/rtc-isl1208.c b/trunk/drivers/rtc/rtc-isl1208.c index 2cd77ab8fc66..054e05294af8 100644 --- a/trunk/drivers/rtc/rtc-isl1208.c +++ b/trunk/drivers/rtc/rtc-isl1208.c @@ -328,6 +328,13 @@ isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) int sr; u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; + /* The clock has an 8 bit wide bcd-coded register (they never learn) + * for the year. tm_year is an offset from 1900 and we are interested + * in the 2000-2099 range, so any value less than 100 is invalid. + */ + if (tm->tm_year < 100) + return -EINVAL; + regs[ISL1208_REG_SC] = bin2bcd(tm->tm_sec); regs[ISL1208_REG_MN] = bin2bcd(tm->tm_min); regs[ISL1208_REG_HR] = bin2bcd(tm->tm_hour) | ISL1208_REG_HR_MIL;