linux/arch/x86
Mateusz Jończyk 775d4661f1 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
Stable-dep-of: cd17420ebe ("rtc: cmos: avoid UIP when writing alarm time")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-14 11:31:55 +01:00
..
boot x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments 2022-08-21 15:15:18 +02:00
configs
crypto
entry x86/entry: Build thunk_$(BITS) only if CONFIG_PREEMPTION=y 2022-08-21 15:16:13 +02:00
events perf/x86/intel/pt: Fix sampling using single range output 2022-11-25 17:45:54 +01:00
hyperv
ia32
include x86/tsx: Add a feature bit for TSX control MSR support 2022-12-08 11:23:59 +01:00
kernel rtc: Check return value from mc146818_get_time() 2022-12-14 11:31:55 +01:00
kvm KVM: x86: remove exit_int_info warning in svm_handle_exit 2022-12-02 17:40:04 +01:00
lib
math-emu
mm x86/ioremap: Fix page aligned size calculation in __ioremap_caller() 2022-12-02 17:40:04 +01:00
net
oprofile
pci
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-21 15:16:14 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-08 11:23:59 +01:00
purgatory
ras
realmode
tools
um arch: um: Mark the stack non-executable to fix a binutils warning 2022-10-15 07:55:53 +02:00
video
xen x86/entry: Work around Clang __bdos() bug 2022-10-26 13:25:45 +02:00
.gitignore
Kbuild
Kconfig x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB 2022-10-30 09:41:19 +01:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu
Makefile.um