rtc/hctosys: only claim the RTC provided the system time if it did

Without this patch /sys/class/rtc/$CONFIG_RTC_HCTOSYS_DEVICE/hctosys
contains a 1 (meaning "This rtc was used to initialize the system clock")
even if reading the time at bootup failed.

Moreover change error handling in rtc_hctosys() to use goto and so reduce
the indention level.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Paul Gortmaker <p_gortmaker@yahoo.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>
This commit is contained in:
Uwe Kleine-König 2010-03-10 15:20:35 -08:00 committed by Linus Torvalds
parent 019b4d123a
commit d0ab4a4d50
3 changed files with 45 additions and 29 deletions

View file

@ -238,6 +238,12 @@ static inline bool is_leap_year(unsigned int year)
return (!(year % 4) && (year % 100)) || !(year % 400);
}
#ifdef CONFIG_RTC_HCTOSYS
extern int rtc_hctosys_ret;
#else
#define rtc_hctosys_ret -ENODEV
#endif
#endif /* __KERNEL__ */
#endif /* _LINUX_RTC_H_ */