* [PATCH v1] clocksource/drivers/tegra: Unwind timer setup on CPUHP failure
@ 2026-08-02 23:35 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-08-02 23:35 UTC (permalink / raw)
To: daniel.lezcano
Cc: tglx, thierry.reding, jonathanh, linux-kernel, linux-tegra,
Yuho Choi
The Tegra timer requests per-CPU interrupts before registering its CPU
hotplug state. If cpuhp_setup_state() fails, the function returns directly
and leaves the requested interrupts registered.
Register the CPU hotplug state before registering the sched clock and
clocksource. On failure, unwind through the existing IRQ cleanup path so
that no registered clocksource is left pointing at an unmapped timer base.
Fixes: b4822dc7564f ("clocksource/drivers/tegra: Add Tegra210 timer support")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/clocksource/timer-tegra.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c
index 35b6ce9deffa..bfcd0a57d856 100644
--- a/drivers/clocksource/timer-tegra.c
+++ b/drivers/clocksource/timer-tegra.c
@@ -331,6 +331,14 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20,
}
}
+ ret = cpuhp_setup_state(CPUHP_AP_TEGRA_TIMER_STARTING,
+ "AP_TEGRA_TIMER_STARTING", tegra_timer_setup,
+ tegra_timer_stop);
+ if (ret) {
+ pr_err("failed to set up cpu hp state: %d\n", ret);
+ goto out_irq;
+ }
+
sched_clock_register(tegra_read_sched_clock, 32, TIMER_1MHz);
ret = clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
@@ -343,13 +351,7 @@ static int __init tegra_init_timer(struct device_node *np, bool tegra20,
register_current_timer_delay(&tegra_delay_timer);
#endif
- ret = cpuhp_setup_state(CPUHP_AP_TEGRA_TIMER_STARTING,
- "AP_TEGRA_TIMER_STARTING", tegra_timer_setup,
- tegra_timer_stop);
- if (ret)
- pr_err("failed to set up cpu hp state: %d\n", ret);
-
- return ret;
+ return 0;
out_irq:
for_each_possible_cpu(cpu) {
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-02 23:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-02 23:35 [PATCH v1] clocksource/drivers/tegra: Unwind timer setup on CPUHP failure Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox