From: Mark Brown Date: Thu, 6 Nov 2008 20:53:18 +0000 (-0800) Subject: rtc: fix handling of missing tm_year data when reading alarms X-Git-Tag: v2.6.28-rc4~81 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9e3a4afd5a66f9047e30ba225525e6ff01612dc4;p=linux-2.6-omap-h63xx.git rtc: fix handling of missing tm_year data when reading alarms When fixing up invalid years rtc_read_alarm() was calling rtc_valid_tm() as a boolean but rtc_valid_tm() returns zero on success or a negative number if the time is not valid so the test was inverted. Signed-off-by: Mark Brown Acked-by: Alessandro Zummo Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 7af60b98d8a..a04c1b6b157 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -271,7 +271,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 (!rtc_valid_tm(&alarm->time)); + } while (rtc_valid_tm(&alarm->time) != 0); break; default: