summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-isl1208.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-24 20:08:26 (GMT)
committerIngo Molnar <mingo@elte.hu>2008-12-24 20:08:26 (GMT)
commitdb8862eafe8a5d030a3b02e81b8bb47447c315e3 (patch)
tree073ea7b46809bf804134cbf008a593413c02a99c /drivers/rtc/rtc-isl1208.c
parentc5dee6177f4bd2095aab7d9be9f6ebdddd6deee9 (diff)
parentc20137fc5329eaf24093fc48c52608dc66be8e5c (diff)
downloadlinux-fsl-qoriq-db8862eafe8a5d030a3b02e81b8bb47447c315e3.tar.xz
Merge branch 'linus' into tracing/hw-branch-tracing
Diffstat (limited to 'drivers/rtc/rtc-isl1208.c')
-rw-r--r--drivers/rtc/rtc-isl1208.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 2cd77ab..054e052 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/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;