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)
commitc5776dec8f2a90a0aa9e197c2900f68fda8dd978
tree7c194e5a9a008ab147e7c926e81dfd0fca9d6dd8
parent2b2f5ff00f63847d95adad6289bd8b05f5983dd5
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