[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251017055039.7307-1-johan@kernel.org>
Date: Fri, 17 Oct 2025 07:50:39 +0200
From: Johan Hovold <johan@...nel.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
linux-kernel@...r.kernel.org,
Johan Hovold <johan@...nel.org>
Subject: [PATCH] clocksource/drivers/stm: Fix double deregistration on probe failure
The purpose of the devm_add_action_or_reset() helper is to call the
action function in case adding an action ever fails so drop the clock
source deregistration from the error path to avoid deregistering twice.
Fixes: cec32ac75827 ("clocksource/drivers/nxp-timer: Add the System Timer Module for the s32gx platforms")
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/clocksource/timer-nxp-stm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/clocksource/timer-nxp-stm.c b/drivers/clocksource/timer-nxp-stm.c
index ce10bdcfc76b..c320d764b12e 100644
--- a/drivers/clocksource/timer-nxp-stm.c
+++ b/drivers/clocksource/timer-nxp-stm.c
@@ -208,10 +208,8 @@ static int nxp_stm_clocksource_init(struct device *dev, struct stm_timer *stm_ti
return ret;
ret = devm_add_action_or_reset(dev, devm_clocksource_unregister, stm_timer);
- if (ret) {
- clocksource_unregister(&stm_timer->cs);
+ if (ret)
return ret;
- }
stm_sched_clock = stm_timer;
--
2.49.1
Powered by blists - more mailing lists