From: <Claudiu.Beznea@microchip.com>
To: <linmq006@gmail.com>, <krzysztof.kozlowski@canonical.com>,
<Nicolas.Ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
<bbrezillon@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] memory: atmel-ebi: Fix missing of_node_put in atmel_ebi_probe
Date: Fri, 18 Mar 2022 12:34:29 +0000 [thread overview]
Message-ID: <22c57600-a9ab-8d3b-e481-1087a6867446@microchip.com> (raw)
In-Reply-To: <20220309110144.22412-1-linmq006@gmail.com>
On 09.03.2022 13:01, Miaoqian Lin wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> The device_node pointer is returned by of_parse_phandle() with refcount
> incremented. We should use of_node_put() on it when done.
>
> Fixes: 87108dc78eb8 ("memory: atmel-ebi: Enable the SMC clock if specified")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/memory/atmel-ebi.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> index c267283b01fd..e749dcb3ddea 100644
> --- a/drivers/memory/atmel-ebi.c
> +++ b/drivers/memory/atmel-ebi.c
> @@ -544,20 +544,27 @@ static int atmel_ebi_probe(struct platform_device *pdev)
> smc_np = of_parse_phandle(dev->of_node, "atmel,smc", 0);
>
> ebi->smc.regmap = syscon_node_to_regmap(smc_np);
> - if (IS_ERR(ebi->smc.regmap))
> - return PTR_ERR(ebi->smc.regmap);
> + if (IS_ERR(ebi->smc.regmap)) {
> + ret = PTR_ERR(ebi->smc.regmap);
> + goto put_node;
> + }
>
> ebi->smc.layout = atmel_hsmc_get_reg_layout(smc_np);
> - if (IS_ERR(ebi->smc.layout))
> - return PTR_ERR(ebi->smc.layout);
> + if (IS_ERR(ebi->smc.layout)) {
> + ret = PTR_ERR(ebi->smc.layout);
> + goto put_node;
> + }
>
> ebi->smc.clk = of_clk_get(smc_np, 0);
> if (IS_ERR(ebi->smc.clk)) {
> - if (PTR_ERR(ebi->smc.clk) != -ENOENT)
> - return PTR_ERR(ebi->smc.clk);
> + if (PTR_ERR(ebi->smc.clk) != -ENOENT) {
> + ret = PTR_ERR(ebi->smc.clk);
> + goto put_node;
> + }
>
> ebi->smc.clk = NULL;
> }
> + of_node_put(smc_np);
> ret = clk_prepare_enable(ebi->smc.clk);
> if (ret)
> return ret;
> @@ -608,6 +615,10 @@ static int atmel_ebi_probe(struct platform_device *pdev)
> }
>
> return of_platform_populate(np, NULL, NULL, dev);
> +
> +put_node:
> + of_node_put(smc_np);
> + return ret;
> }
>
> static __maybe_unused int atmel_ebi_resume(struct device *dev)
> --
> 2.17.1
>
next prev parent reply other threads:[~2022-03-18 12:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 11:01 Miaoqian Lin
2022-03-18 12:34 ` Claudiu.Beznea [this message]
2022-03-18 12:53 ` Krzysztof Kozlowski
2022-04-04 17:08 ` Krzysztof Kozlowski
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=22c57600-a9ab-8d3b-e481-1087a6867446@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=bbrezillon@kernel.org \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linmq006@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.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®