Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/rtc-efi.c: avoid subtracting day twice when computing year days

Compared source code of rtc-lib.c::rtc_year_days() with
efirtc.c::rtc_year_days(), found the code in rtc-efi decreases value of
day twice when it computing year days. rtc-lib.c::rtc_year_days() has
already decrease days and return the year days from 0 to 365.

Signed-off-by: Lee, Chun-Yi <jlee@suse.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>

authored by

Lee, Chun-Yi and committed by
Linus Torvalds
809d9627 6b1a5235

+1 -1
+1 -1
drivers/rtc/rtc-efi.c
··· 35 35 compute_yday(efi_time_t *eft) 36 36 { 37 37 /* efi_time_t.month is in the [1-12] so, we need -1 */ 38 - return rtc_year_days(eft->day - 1, eft->month - 1, eft->year); 38 + return rtc_year_days(eft->day, eft->month - 1, eft->year); 39 39 } 40 40 /* 41 41 * returns day of the week [0-6] 0=Sunday