* [PATCH] phy: tegra: xusb: Call of_node_put(np) only once in tegra_xusb_padctl_get()
@ 2024-09-23 20:04 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2024-09-23 20:04 UTC (permalink / raw)
To: linux-phy, linux-tegra, JC Kuo, Jonathan Hunter,
Kishon Vijay Abraham I, Thierry Reding, Vinod Koul
Cc: LKML, kernel-janitors, Krzysztof Kozlowski
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-23 20:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-23 20:04 [PATCH] phy: tegra: xusb: Call of_node_put(np) only once in tegra_xusb_padctl_get() Markus Elfring
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®