On Wed, Dec 24, 2025 at 07:26:00PM +0800, Haoxiang Li wrote: > On Wed, 24 Dec 2025 12:07:22 +0100, Christophe Leroy wrote: > > Ah yes, I see. > > > > But then all exit paths in fsl_mc_device_add() after device_initialize() > > should call put_device() ? > > > Then in fact the fix should instead be the following, shouldn't it ? > > > diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c > > b/drivers/bus/fsl-mc/fsl-mc-bus.c > > index 25845c04e562..6d132144ce25 100644 > > --- a/drivers/bus/fsl-mc/fsl-mc-bus.c > > +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c > > @@ -905,11 +905,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, > > return 0; > > > > error_cleanup_dev: > > - kfree(mc_dev->regions); > > - if (mc_bus) > > - kfree(mc_bus); > > - else > > - kfree(mc_dev); > > + put_device(&mc_dev->dev); > > > > return error; > > } > > Yes, I think so. > However, I submit a same fix months ago and got a reply: > https://lore.kernel.org/all/2025052622-nautical-suitably-486c@gregkh/ > > I didn't figure out why, and look forward to experts' guidance.
That's a different patch. Perhaps it didn't apply? *shrug*. Christophe's patch looks correct to me. regards, dan carpenter
