lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <86154518-3338-4370-8fa2-80a8b0e10302@web.de>
Date: Mon, 23 Sep 2024 22:04:25 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-phy@...ts.infradead.org, linux-tegra@...r.kernel.org,
 JC Kuo <jckuo@...dia.com>, Jonathan Hunter <jonathanh@...dia.com>,
 Kishon Vijay Abraham I <kishon@...nel.org>,
 Thierry Reding <thierry.reding@...il.com>, Vinod Koul <vkoul@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH] phy: tegra: xusb: Call of_node_put(np) only once in
 tegra_xusb_padctl_get()

From: Markus Elfring <elfring@...rs.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@...rs.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ