lkml.org 
[lkml]   [2018]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] time: fix a missing check of rtc_read_time
Date
When rtc_read_time fails, we shouldn't use it read time. The fix returns
with its error code when it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
kernel/time/alarmtimer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index fa5de5e8de61..19ba8a1633e0 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -293,7 +293,9 @@ static int alarmtimer_suspend(struct device *dev)

/* Setup an rtc timer to fire that far in the future */
rtc_timer_cancel(rtc, &rtctimer);
- rtc_read_time(rtc, &tm);
+ ret = rtc_read_time(rtc, &tm);
+ if (ret < 0)
+ return ret;
now = rtc_tm_to_ktime(tm);
now = ktime_add(now, min);

--
2.17.2 (Apple Git-113)
\
 
 \ /
  Last update: 2018-12-26 05:15    [W:0.024 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site