From: Johan Hovold <johan@kernel.org>
To: cgel.zte@gmail.com
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] soc/tegra: Avoid leak OF node on error
Date: Mon, 23 May 2022 13:54:14 +0200 [thread overview]
Message-ID: <Yot15lTDH8n7+xh5@hovoldconsulting.com> (raw)
In-Reply-To: <20220523111221.3045-1-chi.minghao@zte.com.cn>
On Mon, May 23, 2022 at 11:12:21AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> The OF node should be put before returning error in tegra_init_soc(),
> otherwise node's refcount will be leaked.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/soc/tegra/fuse/fuse-tegra.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index b0a8405dbdb1..ab3e4dc6dc6e 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -612,11 +612,10 @@ static int __init tegra_init_soc(void)
>
> /* make sure we're running on Tegra */
> np = of_find_matching_node(NULL, tegra_fuse_match);
> + of_node_put(np);
> if (!np)
> return 0;
>
> - of_node_put(np);
> -
> soc = tegra_soc_device_register();
> if (IS_ERR(soc)) {
> pr_err("failed to register SoC device: %ld\n", PTR_ERR(soc));
NAK
prev parent reply other threads:[~2022-05-23 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 11:12 cgel.zte
2022-05-23 11:54 ` Johan Hovold [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=Yot15lTDH8n7+xh5@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=zealci@zte.com.cn \
/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®