summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
authorHyogi Gim <hyogi.gim@lge.com>2014-08-08 23:20:11 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-09 00:57:19 +0200
commitca6dc2dab97133b874c2f6a76b6125497b67b429 (patch)
tree82bcedccb2fa224f4d00b9155325699f678f16a8 /drivers/rtc/interface.c
parentdrivers/rtc/rtc-efi.c: check for invalid data coming back from UEFI (diff)
downloadlinux-ca6dc2dab97133b874c2f6a76b6125497b67b429.tar.xz
linux-ca6dc2dab97133b874c2f6a76b6125497b67b429.zip
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>
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r--drivers/rtc/interface.c2
1 files changed, 2 insertions, 0 deletions
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;