mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtc: mxc_v2: fix clock-unprepare race with the still-live alarm IRQ
@ 2026-09-18 15:56 Cong Nguyen
  0 siblings, 0 replies; only message in thread
From: Cong Nguyen @ 2026-09-18 15:56 UTC (permalink / raw)
  To: Frank Li
  Cc: Alexandre Belloni, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, linux-rtc, imx, linux-arm-kernel, linux-kernel

remove() unprepares the clock, but the alarm IRQ is devm-managed and
only actually freed after remove() returns -- so it's still live while
the clock is unprepared. If it fires in that window,
mxc_rtc_interrupt() calls clk_enable() on an unprepared clock.

Free the IRQ explicitly in remove(), before touching the clock, so it
can't fire during or after the unprepare.

Fixes: 55d5a86618d3 ("rtc: mxc_v2: Add missing clk_disable_unprepare()")
Reported-by: Sashiko AI review <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/r/20260914134826.EC26D1F000FF@smtp.kernel.org
Assisted-by: LLM
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
 drivers/rtc/rtc-mxc_v2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
index a07acbbcfaeb..3c174f6004c5 100644
--- a/drivers/rtc/rtc-mxc_v2.c
+++ b/drivers/rtc/rtc-mxc_v2.c
@@ -365,6 +365,7 @@ static void mxc_rtc_remove(struct platform_device *pdev)
 {
 	struct mxc_rtc_data *pdata = platform_get_drvdata(pdev);
 
+	devm_free_irq(&pdev->dev, pdata->irq, &pdev->dev);
 	clk_disable_unprepare(pdata->clk);
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-18 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 15:56 [PATCH] rtc: mxc_v2: fix clock-unprepare race with the still-live alarm IRQ Cong Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®