Skip to content

Commit 6b38a8b

Browse files
jhovolddlezcano
authored andcommitted
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: cec32ac ("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
1 parent 2ba8e2a commit 6b38a8b

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/clocksource/timer-nxp-stm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,8 @@ static int __init nxp_stm_clocksource_init(struct device *dev, struct stm_timer
208208
return ret;
209209

210210
ret = devm_add_action_or_reset(dev, devm_clocksource_unregister, stm_timer);
211-
if (ret) {
212-
clocksource_unregister(&stm_timer->cs);
211+
if (ret)
213212
return ret;
214-
}
215213

216214
stm_sched_clock = stm_timer;
217215

0 commit comments

Comments
 (0)