|
@@ -30,6 +30,14 @@ static int __rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
|
|
|
else {
|
|
|
memset(tm, 0, sizeof(struct rtc_time));
|
|
|
err = rtc->ops->read_time(rtc->dev.parent, tm);
|
|
|
+ if (err < 0) {
|
|
|
+ dev_err(&rtc->dev, "read_time: fail to read\n");
|
|
|
+ return err;
|
|
|
+ }
|
|
|
+
|
|
|
+ err = rtc_valid_tm(tm);
|
|
|
+ if (err < 0)
|
|
|
+ dev_err(&rtc->dev, "read_time: rtc_time isn't valid\n");
|
|
|
}
|
|
|
return err;
|
|
|
}
|