rtc/m48t59: use rtc_valid_tm() to check returned tm
authorWan ZongShun <mcuos.com@gmail.com>
Wed, 11 Aug 2010 01:02:17 +0000 (18:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Aug 2010 15:59:07 +0000 (08:59 -0700)
Use rtc_valid_tm to check the returned struct rtc_time *tm, to avoid
returning a wrong tm value.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-m48t59.c

index 0b66455..a99a0b5 100644 (file)
@@ -105,7 +105,7 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
        dev_dbg(dev, "RTC read time %04d-%02d-%02d %02d/%02d/%02d\n",
                tm->tm_year + 1900, tm->tm_mon, tm->tm_mday,
                tm->tm_hour, tm->tm_min, tm->tm_sec);
-       return 0;
+       return rtc_valid_tm(tm);
 }
 
 static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
@@ -196,7 +196,7 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
        dev_dbg(dev, "RTC read alarm time %04d-%02d-%02d %02d/%02d/%02d\n",
                tm->tm_year + 1900, tm->tm_mon, tm->tm_mday,
                tm->tm_hour, tm->tm_min, tm->tm_sec);
-       return 0;
+       return rtc_valid_tm(tm);
 }
 
 /*