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

drivers/rtc/interface.c: check the error after __rtc_read_time()

In __rtc_set_alarm(), the error after __rtc_read_time() is not checked.
If rtc device fail to read time, we cannot guarantee the following
process.

Add the verification code for returned __rtc_read_time() error.

Signed-off-by: Hyogi Gim <hyogi.gim@lge.com>
Acked-by: 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

Hyogi Gim and committed by
Linus Torvalds
ca6dc2da 6e85bab6

+2
+2
drivers/rtc/interface.c
··· 348 348 349 349 /* Make sure we're not setting alarms in the past */ 350 350 err = __rtc_read_time(rtc, &tm); 351 + if (err) 352 + return err; 351 353 rtc_tm_to_time(&tm, &now); 352 354 if (scheduled <= now) 353 355 return -ETIME;