]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/rtc/interface.c: fix infinite loop in initializing the alarm
authorAles Novak <alnovak@suse.cz>
Wed, 14 May 2014 00:02:36 +0000 (10:02 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 May 2014 00:02:36 +0000 (10:02 +1000)
commit8f5592e97cf9b7380c5c6356f8d6e9e67239aee3
tree0d8950c54295f4332f3cf04cd65cbf0724f2c7bf
parentbc423c88c2d665b753d51a3526c5be6facb28700
drivers/rtc/interface.c: fix infinite loop in initializing the alarm

In __rtc_read_alarm(), if the alarm time retrieved by
rtc_read_alarm_internal() from the device contains invalid values (e.g.
month=2,mday=31) and the year not set (=-1), the initialization will loop
infinitely because the year-fixing loop expects the time being invalid due
to leap year.

Fix reduces the loop to the leap years and adds final validity check.

Signed-off-by: Ales Novak <alnovak@suse.cz>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Reported-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/rtc/interface.c