mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "linyujun (C)" <linyujun809@huawei.com>
To: <abelvesa@kernel.org>, <mturquette@baylibre.com>,
	<sboyd@kernel.org>, <shawnguo@kernel.org>,
	<s.hauer@pengutronix.de>, <kernel@pengutronix.de>,
	<festevam@gmail.com>, <linux-imx@nxp.com>, <aisheng.dong@nxp.com>
Cc: <linux-clk@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] clk: imx: scu: fix memleak on platform_device_add() fails
Date: Mon, 26 Sep 2022 17:13:02 +0800	[thread overview]
Message-ID: <3b7e7b14-d7bd-4d58-3ace-d243c4f038d9@huawei.com> (raw)
In-Reply-To: <20220914033206.98046-1-linyujun809@huawei.com>

kindly ping

在 2022/9/14 11:32, Lin Yujun 写道:
> No error handling is performed when platform_device_add()
> fails. Add error processing before return, and modified
> the return value.
>
> Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---
>   drivers/clk/imx/clk-scu.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index c56e406138db..1e6870f3671f 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -695,7 +695,11 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
>   		pr_warn("%s: failed to attached the power domain %d\n",
>   			name, ret);
>   
> -	platform_device_add(pdev);
> +	ret = platform_device_add(pdev);
> +	if (ret) {
> +		platform_device_put(pdev);
> +		return ERR_PTR(ret);
> +	}
>   
>   	/* For API backwards compatiblilty, simply return NULL for success */
>   	return NULL;

  reply	other threads:[~2022-09-26  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  3:32 Lin Yujun
2022-09-26  9:13 ` linyujun (C) [this message]
2022-10-01  0:06 ` Stephen Boyd
2022-10-01  0:07 ` Stephen Boyd

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=3b7e7b14-d7bd-4d58-3ace-d243c4f038d9@huawei.com \
    --to=linyujun809@huawei.com \
    --cc=abelvesa@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /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

all inboxes | Powered by JetHome®