Skip to content

Commit 775d3c5

Browse files
matijaGPKAGA-KOKO
authored andcommitted
x86/rtc: Remove __init for runtime functions
set_rtc_noop(), get_rtc_noop() are after booting, therefore their __init annotation is wrong. A crash was observed on an x86 platform where CMOS RTC is unused and disabled via device tree. set_rtc_noop() was invoked from ntp: sync_hw_clock(), although CONFIG_RTC_SYSTOHC=n, however sync_cmos_clock() doesn't honour that. Workqueue: events_power_efficient sync_hw_clock RIP: 0010:set_rtc_noop Call Trace: update_persistent_clock64 sync_hw_clock Fix this by dropping the __init annotation from set/get_rtc_noop(). Fixes: c311ed6 ("x86/init: Allow DT configured systems to disable RTC at boot time") Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/59f7ceb1-446b-1d3d-0bc8-1f0ee94b1e18@nokia.com
1 parent 09a9639 commit 775d3c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kernel/x86_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ static int __init iommu_init_noop(void) { return 0; }
3333
static void iommu_shutdown_noop(void) { }
3434
bool __init bool_x86_init_noop(void) { return false; }
3535
void x86_op_int_noop(int cpu) { }
36-
static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
37-
static __init void get_rtc_noop(struct timespec64 *now) { }
36+
static int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
37+
static void get_rtc_noop(struct timespec64 *now) { }
3838

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

0 commit comments

Comments
 (0)