projects
/
profile
/
common
/
platform
/
kernel
/
linux-artik7.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8ca3551
)
rtc: ds1307: prevent to set the specific time value
author
Jaehoon Chung
<jh80.chung@samsung.com>
Fri, 3 Nov 2017 05:29:07 +0000
(14:29 +0900)
committer
Jaehoon Chung
<jh80.chung@samsung.com>
Tue, 29 Jan 2019 02:25:34 +0000
(11:25 +0900)
When using the time over "date 2038-01-19 03:14", Systemd is displaying
the below log as spamming.
"systemd[1]: Time has been changed"
This patch is workaround for preventing to set the value over
"2038-01-19".
Refer to https://patchwork.kernel.org/patch/7133531/
Change-Id: Iab3823b63d738c0c63d4cee439ab53da335f4ef0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/rtc/rtc-ds1307.c
patch
|
blob
|
history
diff --git
a/drivers/rtc/rtc-ds1307.c
b/drivers/rtc/rtc-ds1307.c
index
1f0ee02
..
eaf2c85
100644
(file)
--- a/
drivers/rtc/rtc-ds1307.c
+++ b/
drivers/rtc/rtc-ds1307.c
@@
-392,6
+392,16
@@
static int ds1307_set_time(struct device *dev, struct rtc_time *t)
int tmp;
u8 *buf = ds1307->regs;
+ /*
+ * WORKAROUND:
+ * If try to set 2038/01/19, prevent to set the value.
+ */
+ if (t->tm_year >= 138 && t->tm_mon > 0 && t->tm_mday > 18) {
+ dev_err(dev, "Can't set year = %d, mon = %d, mday = %d\n",
+ t->tm_year + 1900, t->tm_mon, t->tm_mday);
+ return -EINVAL;
+ }
+
dev_dbg(dev, "%s secs=%d, mins=%d, "
"hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
"write", t->tm_sec, t->tm_min,