diff options
author | Ilya Ledvich <ilya@compulab.co.il> | 2019-11-01 12:54:22 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-11-08 18:14:09 +0300 |
commit | 394c051d0fe2d94254522514d4454338f266e98d (patch) | |
tree | 14a1d1e33097e68a60fa7b1e9f2b278879bffd28 /drivers/rtc | |
parent | 94303f8930ed78aea0f189b703c9d79fff9555d7 (diff) | |
download | linux-394c051d0fe2d94254522514d4454338f266e98d.tar.xz |
rtc: em3027: correct month value
The RTC month value is 1-indexed, but the kernel assumes it is 0-indexed.
This may result in the RTC not rolling over correctly.
Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191101095422.14787-1-ilya@compulab.co.il
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-em3027.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-em3027.c b/drivers/rtc/rtc-em3027.c index 77cca1392253..9f176bce48ba 100644 --- a/drivers/rtc/rtc-em3027.c +++ b/drivers/rtc/rtc-em3027.c @@ -71,7 +71,7 @@ static int em3027_get_time(struct device *dev, struct rtc_time *tm) tm->tm_hour = bcd2bin(buf[2]); tm->tm_mday = bcd2bin(buf[3]); tm->tm_wday = bcd2bin(buf[4]); - tm->tm_mon = bcd2bin(buf[5]); + tm->tm_mon = bcd2bin(buf[5]) - 1; tm->tm_year = bcd2bin(buf[6]) + 100; return 0; @@ -94,7 +94,7 @@ static int em3027_set_time(struct device *dev, struct rtc_time *tm) buf[3] = bin2bcd(tm->tm_hour); buf[4] = bin2bcd(tm->tm_mday); buf[5] = bin2bcd(tm->tm_wday); - buf[6] = bin2bcd(tm->tm_mon); + buf[6] = bin2bcd(tm->tm_mon + 1); buf[7] = bin2bcd(tm->tm_year % 100); /* write time/date registers */ |