rtc_time_to_tm: fix signed/unsigned arithmetic
[firefly-linux-kernel-4.4.55.git] / drivers / rtc / rtc-lib.c
index 9f996ec881ce90dbf2a97cef5ecb73e090d634c7..dd70bf73ce9d5e3dd5fa1686c12f1c46421b5624 100644 (file)
@@ -51,10 +51,11 @@ EXPORT_SYMBOL(rtc_year_days);
  */
 void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
 {
-       unsigned int days, month, year;
+       unsigned int month, year;
+       int days;
 
        days = time / 86400;
-       time -= days * 86400;
+       time -= (unsigned int) days * 86400;
 
        /* day of the week, 1970-01-01 was a Thursday */
        tm->tm_wday = (days + 4) % 7;