[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aU5X7bpTSgjsSfMm@stanley.mountain>
Date: Fri, 26 Dec 2025 12:39:57 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
Cc: chleroy@...nel.org, ioana.ciornei@....com, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, suhui@...china.com
Subject: Re: [PATCH] bus: fsl-mc: fix an error handling in fsl_mc_device_add()
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
Powered by blists - more mailing lists