linux-stable/drivers/base/power
Mateusz Jończyk be6c3152d6 rtc: Check return value from mc146818_get_time()
[ Upstream commit 0dd8d6cb9e ]

There are 4 users of mc146818_get_time() and none of them was checking
the return value from this function. Change this.

Print the appropriate warnings in callers of mc146818_get_time() instead
of in the function mc146818_get_time() itself, in order not to add
strings to rtc-mc146818-lib.c, which is kind of a library.

The callers of alpha_rtc_read_time() and cmos_read_time() may use the
contents of (struct rtc_time *) even when the functions return a failure
code. Therefore, set the contents of (struct rtc_time *) to 0x00,
which looks more sensible then 0xff and aligns with the (possibly
stale?) comment in cmos_read_time:

	/*
	 * If pm_trace abused the RTC for storage, set the timespec to 0,
	 * which tells the caller that this RTC value is unusable.
	 */

For consistency, do this in mc146818_get_time().

Note: hpet_rtc_interrupt() may call mc146818_get_time() many times a
second. It is very unlikely, though, that the RTC suddenly stops
working and mc146818_get_time() would consistently fail.

Only compile-tested on alpha.

Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-alpha@vger.kernel.org
Cc: x86@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211210200131.153887-4-mat.jonczyk@o2.pl
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-13 20:59:14 +02:00
..
clock_ops.c PM: runtime: add devm_pm_clk_create helper 2021-08-26 11:28:07 -07:00
common.c PM / Domains: Introduce dev_pm_domain_start() 2019-11-13 11:41:50 +01:00
domain.c PM: domains: Fix sleep-in-atomic bug caused by genpd_debug_remove() 2022-04-08 14:23:02 +02:00
domain_governor.c PM: domains: fix some kernel-doc issues 2021-06-08 14:56:11 +02:00
generic_ops.c drivers: base: power: add proper SPDX identifiers on files that did not have them. 2019-04-04 20:03:40 +02:00
main.c PM: core: keep irq flags in device_pm_check_callbacks() 2022-04-08 14:23:56 +02:00
Makefile PM / QoS: Initial kunit test 2019-11-29 12:04:49 +01:00
power.h drivers/base/power: add dpm_sysfs_change_owner() 2020-02-26 20:07:25 -08:00
qos-test.c kunit: allow kunit tests to be loaded as a module 2020-01-09 16:42:29 -07:00
qos.c PM / QoS: Restore DEV_PM_QOS_MIN/MAX_FREQUENCY 2019-11-29 12:04:50 +01:00
runtime.c PM: runtime: Add safety net to supplier device release 2022-01-27 11:04:44 +01:00
sysfs.c drivers core: Miscellaneous changes for sysfs_emit 2020-10-02 13:12:07 +02:00
trace.c rtc: Check return value from mc146818_get_time() 2022-04-13 20:59:14 +02:00
wakeirq.c PM: sleep: wakeirq: drop useless parameter from dev_pm_attach_wake_irq() 2021-09-07 21:10:09 +02:00
wakeup.c PM: s2idle: ACPI: Fix wakeup interrupts handling 2022-02-16 12:56:19 +01:00
wakeup_stats.c PM: wakeup: remove redundant assignment to variable retval 2021-04-22 15:22:38 +02:00