From: Ales Novak Date: Thu, 22 May 2014 00:43:46 +0000 (+1000) Subject: drivers/rtc/interface.c: fix for fix of alarm initialization X-Git-Tag: next-20140530~2^2~137 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e25375669f670dfc3075553a1581d43b838ffa40;p=karo-tx-linux.git drivers/rtc/interface.c: fix for fix of alarm initialization Seems the previous patch "fix infinite loop in initializing the alarm" did break the infinite loop in alarm initialization, but not in the right way. The loop indeed should walk through the not-leap years and stop on the leap one. This patch does apply on top of the previous one. Signed-off-by: Ales Novak Cc: Alessandro Zummo Signed-off-by: Andrew Morton --- diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 13f93fa7fa80..5813fa52c3d4 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -292,8 +292,7 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) dev_dbg(&rtc->dev, "alarm rollover: %s\n", "year"); do { alarm->time.tm_year++; - } while (alarm->time.tm_mon == 1 - && is_leap_year(alarm->time.tm_year + 1900) + } while (!is_leap_year(alarm->time.tm_year + 1900) && rtc_valid_tm(&alarm->time) != 0); break;