Skip to content

Commit 70bb843

Browse files
outman119bjorn-helgaas
authored andcommitted
PCI/pwrctrl: Fix pci_pwrctrl_is_required() device node leak
The for_each_endpoint_of_node() macro requires calling of_node_put() on the endpoint node when breaking out of the loop early. Add of_node_put(endpoint) before the early return to release the reference. Fixes: cf3287f ("PCI/pwrctrl: Ensure that remote endpoint node parent has supply requirement") Signed-off-by: Felix Gu <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 2d8c509 commit 70bb843

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/pci/pwrctrl/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ static bool pci_pwrctrl_is_required(struct device_node *np)
299299
struct device_node *remote __free(device_node) =
300300
of_graph_get_remote_port_parent(endpoint);
301301
if (remote) {
302-
if (of_pci_supply_present(remote))
302+
if (of_pci_supply_present(remote)) {
303+
of_node_put(endpoint);
303304
return true;
305+
}
304306
}
305307
}
306308
}

0 commit comments

Comments
 (0)