WSL2-Linux-Kernel/arch/alpha/kernel
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
..
syscalls Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
.gitignore
Makefile
asm-offsets.c
audit.c
binfmt_loader.c
bugs.c
console.c
core_apecs.c
core_cia.c
core_irongate.c
core_lca.c
core_marvel.c
core_mcpcia.c
core_polaris.c
core_t2.c
core_titan.c
core_tsunami.c
core_wildfire.c
entry.S
err_common.c
err_ev6.c
err_ev7.c
err_impl.h
err_marvel.c
err_titan.c
es1888.c
gct.c
head.S
io.c
irq.c
irq_alpha.c
irq_i8259.c
irq_impl.h
irq_pyxis.c
irq_srm.c
machvec_impl.h
module.c
osf_sys.c Merge branch 'siginfo-si_trapno-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-09-01 14:42:36 -07:00
pc873xx.c
pc873xx.h
pci-noop.c
pci-sysfs.c alpha: pci-sysfs: fix all kernel-doc warnings 2021-09-08 11:50:25 -07:00
pci.c
pci_impl.h
pci_iommu.c alpha: return error code from alpha_pci_map_sg() 2021-08-09 17:13:05 +02:00
perf_event.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
process.c alpha: convert comma to semicolon 2021-07-25 22:32:59 -07:00
proto.h
ptrace.c
rtc.c rtc: Check return value from mc146818_get_time() 2022-04-13 20:59:14 +02:00
setup.c alpha: register early reserved memory in memblock 2021-07-28 20:49:18 -07:00
signal.c signal/alpha: si_trapno is only used with SIGFPE and SIGTRAP TRAP_UNK 2021-07-23 13:10:26 -05:00
smc37c93x.c
smc37c669.c
smp.c alpha: Send stop IPI to send to online CPUs 2021-07-25 22:33:03 -07:00
srm_env.c
srmcons.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
sys_alcor.c
sys_cabriolet.c
sys_dp264.c
sys_eb64p.c
sys_eiger.c
sys_jensen.c alpha: mark 'Jensen' platform as no longer broken 2021-09-18 14:12:39 -07:00
sys_marvel.c
sys_miata.c
sys_mikasa.c
sys_nautilus.c alpha: fix spelling mistakes 2021-07-25 22:33:04 -07:00
sys_noritake.c
sys_rawhide.c
sys_ruffian.c
sys_rx164.c
sys_sable.c
sys_sio.c
sys_sx164.c
sys_takara.c
sys_titan.c
sys_wildfire.c
systbls.S
time.c
traps.c Merge branch 'siginfo-si_trapno-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-09-01 14:42:36 -07:00
vmlinux.lds.S