]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/rtc/rtc-wilco-ec.c
cfg80211: fix memory leak in cfg80211_cqm_rssi_update
[linux.git] / drivers / rtc / rtc-wilco-ec.c
index 8ad4c4e6d5579e79c81e0550040d6327df381071..ff46066a68a4c8bd080d74a7de4f38b907b01e89 100644 (file)
@@ -110,10 +110,12 @@ static int wilco_ec_rtc_read(struct device *dev, struct rtc_time *tm)
        tm->tm_mday     = rtc.day;
        tm->tm_mon      = rtc.month - 1;
        tm->tm_year     = rtc.year + (rtc.century * 100) - 1900;
-       tm->tm_yday     = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
+       /* Ignore other tm fields, man rtc says userspace shouldn't use them. */
 
-       /* Don't compute day of week, we don't need it. */
-       tm->tm_wday = -1;
+       if (rtc_valid_tm(tm)) {
+               dev_err(dev, "Time from RTC is invalid: %ptRr\n", tm);
+               return -EIO;
+       }
 
        return 0;
 }