Skip to content

Commit

Permalink
drivers/rtc/interface.c: check the error after __rtc_read_time()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hyogi Gim authored and torvalds committed Aug 8, 2014
1 parent 6e85bab commit ca6dc2d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/rtc/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ca6dc2d

Please sign in to comment.