Skip to contentSkip to conversation

time: fix a missing check of rtc_read_time

PATCH New Kangjie Lu 1 participant 1 message Dec 26, 2018 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 time: fix a missing check of rtc_read_time

When rtc_read_time fails, we shouldn't use it read time. The fix returns with its error code when it fails.

---
 kernel/time/alarmtimer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/time/alarmtimer.c +3 -1
index fa5de5e8de61..19ba8a1633e0 100644
@@ -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);
 
Signature · 1 line
2.17.2 (Apple Git-113)