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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240719223805.102929-1-david.hunter.linux@gmail.com>
Date: Fri, 19 Jul 2024 18:38:05 -0400
From: David Hunter <david.hunter.linux@...il.com>
To: bhelgaas@...gle.com,
	linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: David Hunter <david.hunter.linux@...il.com>,
	julia.lawall@...ia.fr,
	skhan@...uxfoundation.org,
	javier.carrasco.cruz@...il.com
Subject: [PATCH] of.c: replace of_node_put with __free improves cleanup

The use of the __free function allows the cleanup to be based on scope
instead of on another function called later. This makes the cleanup
automatic and less susceptible to errors later.

This code was compiled without errors or warnings.

Signed-off-by: David Hunter <david.hunter.linux@...il.com>
---
 drivers/pci/of.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index b908fe1ae951..8b150982f5cd 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -616,16 +616,14 @@ int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge)
 
 void of_pci_remove_node(struct pci_dev *pdev)
 {
-	struct device_node *np;
+	struct device_node *np __free(device_node) = pci_device_to_OF_node(pdev);
 
-	np = pci_device_to_OF_node(pdev);
 	if (!np || !of_node_check_flag(np, OF_DYNAMIC))
 		return;
 	pdev->dev.of_node = NULL;
 
 	of_changeset_revert(np->data);
 	of_changeset_destroy(np->data);
-	of_node_put(np);
 }
 
 void of_pci_make_dev_node(struct pci_dev *pdev)
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ