diff options
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
| -rw-r--r-- | drivers/rtc/rtc-cmos.c | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 7030d7cd3861..38aa8e1906c2 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -191,6 +191,13 @@ static inline void cmos_write_bank2(unsigned char val, unsigned char addr)  static int cmos_read_time(struct device *dev, struct rtc_time *t)  { +	/* +	 * If pm_trace abused the RTC for storage, set the timespec to 0, +	 * which tells the caller that this RTC value is unusable. +	 */ +	if (!pm_trace_rtc_valid()) +		return -EIO; +  	/* REVISIT:  if the clock has a "century" register, use  	 * that instead of the heuristic in mc146818_get_time().  	 * That'll make Y3K compatility (year > 2070) easy!  |