From: Greg KH <gregkh@linuxfoundation.org>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: ioana.ciornei@nxp.com, agraf@suse.de,
German.Rivera@freescale.com, stuart.yoder@freescale.com,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] bus: fsl-mc: Fix an API misuse in fsl_mc_device_add()
Date: Mon, 26 May 2025 11:03:41 +0200 [thread overview]
Message-ID: <2025052622-nautical-suitably-486c@gregkh> (raw)
In-Reply-To: <20250526083622.3671123-1-haoxiang_li2024@163.com>
On Mon, May 26, 2025 at 04:36:22PM +0800, Haoxiang Li wrote:
> In fsl_mc_device_add(), use put_device() to give up the
> device reference instead of kfree().
>
> Fixes: bbf9d17d9875 ("staging: fsl-mc: Freescale Management Complex (fsl-mc) bus driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> drivers/bus/fsl-mc/fsl-mc-bus.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index a8be8cf246fb..dfd79ecf65b6 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -905,9 +905,7 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
> return 0;
>
> error_cleanup_dev:
> - kfree(mc_dev->regions);
> - kfree(mc_bus);
> - kfree(mc_dev);
> + put_device(&mc_dev->dev);
>
> return error;
> }
No, sorry, this is not corrrect at all. Always test your patches before
submitting them.
greg k-h
prev parent reply other threads:[~2025-05-26 9:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 8:36 [PATCH] bus: fsl-mc: Fix an API misuse in fsl_mc_device_add() Haoxiang Li
2025-05-26 9:03 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025052622-nautical-suitably-486c@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=German.Rivera@freescale.com \
--cc=agraf@suse.de \
--cc=haoxiang_li2024@163.com \
--cc=ioana.ciornei@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=stable@vger.kernel.org \
--cc=stuart.yoder@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).