]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: ds1685: correct day of month checking
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 21 May 2016 22:18:55 +0000 (00:18 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 4 Jun 2016 13:46:08 +0000 (15:46 +0200)
commit7d09a36d0387437e232517be702b6e079ab20054
tree7c194e5a9a008ab147e7c926e81dfd0fca9d6dd8
parent4abb6f4c374273465d205aaf821fb0229afe30a4
rtc: ds1685: correct day of month checking

The day of month is checked in ds1685_rtc_read_alarm
and ds1685_rtc_set_alarm.

Multiple errors exist in the day of month check.

Operator ! has a higher priority than &&.
(!(mday >= 1) && (mday <= 31)) is false for mday == 32.

When verifying the day of month the binary and the BCD mode
have to be considered.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1685.c