Skip to content

Commit c28c2d4

Browse files
committed
powerpc/pasemi: Use of_root in pas_pci_init()
Currently in pas_pci_init() a reference to the root node is leaked due to a missing of_node_put(). Instead just use of_root directly. Note that converting to of_find_compatible_node(NULL, ...) would not be entirely equivalent, because that would check the compatible property of the root node, whereas using of_root skips checking the root node and start the search at the first child of the root. Reported-by: Liang He <windhl@126.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220906010313.1296714-1-mpe@ellerman.id.au
1 parent 2456854 commit c28c2d4

File tree

1 file changed

+2
-8
lines changed
  • arch/powerpc/platforms/pasemi

1 file changed

+2
-8
lines changed

arch/powerpc/platforms/pasemi/pci.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,12 @@ static int __init pas_add_bridge(struct device_node *dev)
270270

271271
void __init pas_pci_init(void)
272272
{
273-
struct device_node *np, *root;
273+
struct device_node *np;
274274
int res;
275275

276-
root = of_find_node_by_path("/");
277-
if (!root) {
278-
pr_crit("pas_pci_init: can't find root of device tree\n");
279-
return;
280-
}
281-
282276
pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
283277

284-
np = of_find_compatible_node(root, NULL, "pasemi,rootbus");
278+
np = of_find_compatible_node(of_root, NULL, "pasemi,rootbus");
285279
if (np) {
286280
res = pas_add_bridge(np);
287281
of_node_put(np);

0 commit comments

Comments
 (0)