From: cgel.zte@gmail.com
To: thierry.reding@gmail.com
Cc: 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: [PATCH] soc/tegra: Avoid leak OF node on error
Date: Mon, 23 May 2022 11:12:21 +0000 [thread overview]
Message-ID: <20220523111221.3045-1-chi.minghao@zte.com.cn> (raw)
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));
--
2.25.1
next reply other threads:[~2022-05-23 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 11:12 cgel.zte [this message]
2022-05-23 11:54 ` [PATCH] soc/tegra: Avoid leak OF node on error Johan Hovold
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=20220523111221.3045-1-chi.minghao@zte.com.cn \
--to=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;
as well as URLs for NNTP newsgroup(s).