Commit ca6dc2da authored by Hyogi Gim's avatar Hyogi Gim Committed by Linus Torvalds

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: default avatarHyogi Gim <hyogi.gim@lge.com>
Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6e85bab6
...@@ -348,6 +348,8 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) ...@@ -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 */ /* Make sure we're not setting alarms in the past */
err = __rtc_read_time(rtc, &tm); err = __rtc_read_time(rtc, &tm);
if (err)
return err;
rtc_tm_to_time(&tm, &now); rtc_tm_to_time(&tm, &now);
if (scheduled <= now) if (scheduled <= now)
return -ETIME; return -ETIME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment