set_rtc_noop, get_rtc_noop are used runtime, therefore need __init removed. Problem was observed on x86 platform where cmos rtc is unused and disabled via device tree. Function was triggered from ntp: sync_hw_clock, although CONFIG_RTC_SYSTOHC=n, however sync_cmos_clock doesn't honour that. BUG: unable to handle page fault for address: ffffffff82945193 #PF: supervisor instruction fetch in kernel mode #PF: error_code(0x0011) - permissions violation PGD 420d067 P4D 420d067 PUD 420e063 PMD 29185d063 PTE 8000000004945163 Oops: 0011 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 539 Comm: kworker/1:1 Tainted: G S O 5.10.141-3c37b890b4-nokia_sm_x86 #1 Hardware name: Nokia Asil/Default string, BIOS 0ACNA108 06/13/2022 Workqueue: events_power_efficient sync_hw_clock RIP: 0010:set_rtc_noop+0x0/0xf Code: cc cc cc cc cc [...] RSP: 0000:ffffc9002467fe38 EFLAGS: 00010282 RAX: ffffffff82945193 RBX: ffff8882edef1380 RCX: 0000000000000018 RDX: 0000000000a8467f RSI: 0000000000000000 RDI: ffffc9002467fe40 RBP: ffffc9002467fe50 R08: 001e63aad609496d R09: ffff8882edef13fc R10: 0000000000000018 R11: 0000000000000018 R12: ffff88847006c680 R13: ffff888470070c00 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff888470040000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffff82945193 CR3: 00000002ef6ba000 CR4: 0000000000350fe0 Call Trace: update_persistent_clock64+0x22/0x30 sync_hw_clock+0x125/0x160 process_one_work+0x1c2/0x3c0 worker_thread+0x4d/0x3d0 ? rescuer_thread+0x390/0x390 kthread+0x130/0x150 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x1f/0x30 CR2: ffffffff82945193 ---[ end trace fa3cbf08de1cf1dd ]--- Fixes: c311ed6183f4: ("x86/init: Allow DT configured systems to disable RTC at boot time") Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@xxxxxxxxx> --- arch/x86/kernel/x86_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 57353519bc11..0ab707bbefe2 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c @@ -32,8 +32,8 @@ static int __init iommu_init_noop(void) { return 0; } static void iommu_shutdown_noop(void) { } bool __init bool_x86_init_noop(void) { return false; } void x86_op_int_noop(int cpu) { } -static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; } -static __init void get_rtc_noop(struct timespec64 *now) { } +static int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; } +static void get_rtc_noop(struct timespec64 *now) { } static __initconst const struct of_device_id of_cmos_match[] = { { .compatible = "motorola,mc146818" }, -- 2.31.0