Hi, On Sun, Nov 29, 2026 at 05:47:43PM +0800, Tian Xuechen wrote: > From: Tian Xuechen <202300460064@mail.sdu.edu.cn> > > The restart handler is embedded in the device-managed reset context. > Unregister it on removal so the restart notifier chain no longer > references the context when devres frees it. > > This issue was found by our static analysis tool under development. > > Fixes: 6ab739bc1d00 ("power: reset: Add a driver for the Microsemi Ocelot reset") > Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn> > --- I queued a different fix, which was sent before this one. Greetings, -- Sebastian > drivers/power/reset/ocelot-reset.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/power/reset/ocelot-reset.c b/drivers/power/reset/ocelot-reset.c > index 0acfa63b6b5d..4f0010994940 100644 > --- a/drivers/power/reset/ocelot-reset.c > +++ b/drivers/power/reset/ocelot-reset.c > @@ -87,6 +87,7 @@ static int ocelot_reset_probe(struct platform_device *pdev) > return PTR_ERR(ctx->cpu_ctrl); > } > > + platform_set_drvdata(pdev, ctx); > ctx->restart_handler.notifier_call = ocelot_restart_handle; > ctx->restart_handler.priority = 192; > err = register_restart_handler(&ctx->restart_handler); > @@ -96,6 +97,13 @@ static int ocelot_reset_probe(struct platform_device *pdev) > return err; > } > > +static void ocelot_reset_remove(struct platform_device *pdev) > +{ > + struct ocelot_reset_context *ctx = platform_get_drvdata(pdev); > + > + unregister_restart_handler(&ctx->restart_handler); > +} > + > static const struct reset_props reset_props_jaguar2 = { > .syscon = "mscc,ocelot-cpu-syscon", > .protect_reg = 0x20, > @@ -143,6 +151,7 @@ static const struct of_device_id ocelot_reset_of_match[] = { > > static struct platform_driver ocelot_reset_driver = { > .probe = ocelot_reset_probe, > + .remove = ocelot_reset_remove, > .driver = { > .name = "ocelot-chip-reset", > .of_match_table = ocelot_reset_of_match, > > -- > 2.43.0 > >