From: Markus Elfring <Markus.Elfring@web.de>
To: linux-phy@lists.infradead.org, linux-tegra@vger.kernel.org,
JC Kuo <jckuo@nvidia.com>, Jonathan Hunter <jonathanh@nvidia.com>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Vinod Koul <vkoul@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH] phy: tegra: xusb: Call of_node_put(np) only once in tegra_xusb_padctl_get()
Date: Mon, 23 Sep 2024 22:04:25 +0200 [thread overview]
Message-ID: <86154518-3338-4370-8fa2-80a8b0e10302@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Sep 2024 21:56:35 +0200
An of_node_put(np) call was immediately used after a pointer check
for a of_find_device_by_node() call in this function implementation.
Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/phy/tegra/xusb.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index cfdb54b6070a..1a912ed52416 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -1345,12 +1345,9 @@ struct tegra_xusb_padctl *tegra_xusb_padctl_get(struct device *dev)
* only ever be one per SoC that would be a little overkill.
*/
pdev = of_find_device_by_node(np);
- if (!pdev) {
- of_node_put(np);
- return ERR_PTR(-ENODEV);
- }
-
of_node_put(np);
+ if (!pdev)
+ return ERR_PTR(-ENODEV);
padctl = platform_get_drvdata(pdev);
if (!padctl) {
--
2.46.1
reply other threads:[~2024-09-23 20:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=86154518-3338-4370-8fa2-80a8b0e10302@web.de \
--to=markus.elfring@web.de \
--cc=jckuo@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=vkoul@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®