[PATCH] rtc: mxc_v2: fix clock-unprepare race with the still-live alarm IRQ

From: Cong Nguyen

Date: Fri Sep 18 2026 - 12:38:06 EST


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@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20260914134826.EC26D1F000FF@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
---
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