PCI: apple: Use helper function for_each_child_of_node_scoped()
[ Upstream commit f60b4e06a945f25d463ae065c6e41c6e24faee0a ] 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 <zhangzekun11@huawei.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20240831040413.126417-6-zhangzekun11@huawei.com [kwilczynski: commit log] Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Stable-dep-of: 751bec089c4e ("PCI: apple: Set only available ports up") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
df1d7e879e
commit
b8704eef56
@@ -767,7 +767,6 @@ static int apple_pcie_init(struct pci_config_window *cfg)
|
|||||||
{
|
{
|
||||||
struct device *dev = cfg->parent;
|
struct device *dev = cfg->parent;
|
||||||
struct platform_device *platform = to_platform_device(dev);
|
struct platform_device *platform = to_platform_device(dev);
|
||||||
struct device_node *of_port;
|
|
||||||
struct apple_pcie *pcie;
|
struct apple_pcie *pcie;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -790,11 +789,10 @@ static int apple_pcie_init(struct pci_config_window *cfg)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for_each_child_of_node(dev->of_node, of_port) {
|
for_each_child_of_node_scoped(dev->of_node, of_port) {
|
||||||
ret = apple_pcie_setup_port(pcie, of_port);
|
ret = apple_pcie_setup_port(pcie, of_port);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(pcie->dev, "Port %pOF setup fail: %d\n", of_port, ret);
|
dev_err(pcie->dev, "Port %pOF setup fail: %d\n", of_port, ret);
|
||||||
of_node_put(of_port);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user