[tip: x86/urgent] x86/init: Initialize wall clock in get_rtc_noop()

From: tip-bot2 for Naman Jain

Date: Tue Nov 03 2026 - 00:57:19 EST


The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: 7d5af1f256fdecff6a7986bbc9146b69cb355bb5
Gitweb: https://git.kernel.org/tip/7d5af1f256fdecff6a7986bbc9146b69cb355bb5
Author: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx>
AuthorDate: Mon, 31 Aug 2026 08:25:28
Committer: Borislav Petkov (AMD) <bp@xxxxxxxxx>
CommitterDate: Mon, 02 Nov 2026 21:38:37 -08:00

x86/init: Initialize wall clock in get_rtc_noop()

get_rtc_noop() is used when an RTC is unavailable, but leaves its output
argument untouched. When CONFIG_INIT_STACK_ALL_ZERO is not enabled,
timekeeping_init() may therefore receive a nonzero invalid persistent
clock value and warn:

"Persistent clock returned invalid value"

Initialize the output to zero, the documented representation of an
unsupported persistent clock.

Fixes: c311ed6183f4 ("x86/init: Allow DT configured systems to disable RTC at boot time")
Signed-off-by: Naman Jain <namjain@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Roman Kisel <vdso@xxxxxxxxxxx>
Reviewed-by: Hardik Garg <hargar@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Link: https://patch.msgid.link/20260831082528.1623843-1-namjain@xxxxxxxxxxxxxxxxxxx
---
arch/x86/kernel/x86_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 252c582..3b9b418 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -37,7 +37,7 @@ static void iommu_shutdown_noop(void) { }
bool __init bool_x86_init_noop(void) { return false; }
void x86_op_int_noop(int cpu) { }
int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
-void get_rtc_noop(struct timespec64 *now) { }
+void get_rtc_noop(struct timespec64 *now) { *now = (struct timespec64){0}; }

static __initconst const struct of_device_id of_cmos_match[] = {
{ .compatible = "motorola,mc146818" },