Skip to content

Commit f60b4e0

Browse files
Zhang Zekunkwilczynski
authored andcommitted
PCI: apple: Use helper function for_each_child_of_node_scoped()
The for_each_available_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Thus, use this helper to simplify the code. Signed-off-by: Zhang Zekun <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] [kwilczynski: commit log] Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent 8905f8b commit f60b4e0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/pci/controller/pcie-apple.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,6 @@ static int apple_pcie_init(struct pci_config_window *cfg)
732732
{
733733
struct device *dev = cfg->parent;
734734
struct platform_device *platform = to_platform_device(dev);
735-
struct device_node *of_port;
736735
struct apple_pcie *pcie;
737736
int ret;
738737

@@ -755,11 +754,10 @@ static int apple_pcie_init(struct pci_config_window *cfg)
755754
if (ret)
756755
return ret;
757756

758-
for_each_child_of_node(dev->of_node, of_port) {
757+
for_each_child_of_node_scoped(dev->of_node, of_port) {
759758
ret = apple_pcie_setup_port(pcie, of_port);
760759
if (ret) {
761760
dev_err(pcie->dev, "Port %pOF setup fail: %d\n", of_port, ret);
762-
of_node_put(of_port);
763761
return ret;
764762
}
765763
}

0 commit comments

Comments
 (0)