[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251224112600.1592218-1-lihaoxiang@isrc.iscas.ac.cn>
Date: Wed, 24 Dec 2025 19:26:00 +0800
From: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
To: chleroy@...nel.org
Cc: dan.carpenter@...aro.org,
ioana.ciornei@....com,
lihaoxiang@...c.iscas.ac.cn,
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, 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.
Thanks,
Haoxiang Li
Powered by blists - more mailing lists