On Fri, Jan 23, 2026 at 07:35:29PM +0800, Haoxiang Li wrote:
> Hi, Ioana:
>
> On Fri, 23 Jan 2026 13:10:46 +0200, Ioana Ciornei wrote:
> > Is there any reason why you didn't go with Christophe's suggestion from
> > https://lore.kernel.org/all/[email protected]/
> > ?
>
> > It's perfectly valid to call put_device() even though device_add() was
> > not called, meaning from the other code paths.
>
> Actually, I totally agree with that suggestion. However, I submit a same fix
> several months ago and got a reply:
> https://lore.kernel.org/all/2025052622-nautical-suitably-486c@gregkh/
>
> I didn't figure out why.
I think the problem was that the patch did not apply because commit
d694bf8a9acd ("bus: fsl-mc: fix double-free on mc_dev") was already
applied.
> And if you agree with the Christophe's suggestion,
> I will resubmit a patch v3.
Yes, I do agree with Christophe's suggestion. I even tested a bit that
both cases, with and without device_add() getting called, resources are
released properly if you use put_device().
Thanks!