From: Hyogi Gim Date: Fri, 8 Aug 2014 21:20:11 +0000 (-0700) Subject: drivers/rtc/interface.c: check the error after __rtc_read_time() X-Git-Tag: firefly_0821_release~176^2~3441^2~167 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ca6dc2dab97133b874c2f6a76b6125497b67b429;p=firefly-linux-kernel-4.4.55.git 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 Acked-by: Alessandro Zummo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 5813fa52c3d4..5b2717f5dafa 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -348,6 +348,8 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) /* Make sure we're not setting alarms in the past */ err = __rtc_read_time(rtc, &tm); + if (err) + return err; rtc_tm_to_time(&tm, &now); if (scheduled <= now) return -ETIME;