]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
clocksource/drivers/stm: Fix double deregistration on probe failure
authorJohan Hovold <johan@kernel.org>
Fri, 17 Oct 2025 05:50:39 +0000 (07:50 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 26 Nov 2025 10:24:37 +0000 (11:24 +0100)
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")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20251017055039.7307-1-johan@kernel.org
drivers/clocksource/timer-nxp-stm.c

index bbc40623728fa5f2b2702811739c48620883a6fd..16d52167e949be9515a5c168326c02605fa3800b 100644 (file)
@@ -208,10 +208,8 @@ static int __init nxp_stm_clocksource_init(struct device *dev, struct stm_timer
                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;