From: Krzysztof Kozlowski Date: Tue, 17 Mar 2026 13:33:25 +0000 (+0100) Subject: PCI: pnv_php: Simplify with scoped for each OF child loop X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c4cac4a15c6e7a6f9517a2ddc9dc8d7d0d1aa11c;p=thirdparty%2Fkernel%2Flinux.git PCI: pnv_php: Simplify with scoped for each OF child loop Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Ilpo Järvinen Link: https://patch.msgid.link/20260317133322.266102-7-krzysztof.kozlowski@oss.qualcomm.com --- diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 5c020831e318f..ff92a5c301b81 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c @@ -215,24 +215,19 @@ static void pnv_php_reverse_nodes(struct device_node *parent) static int pnv_php_populate_changeset(struct of_changeset *ocs, struct device_node *dn) { - struct device_node *child; - int ret = 0; + int ret; - for_each_child_of_node(dn, child) { + for_each_child_of_node_scoped(dn, child) { ret = of_changeset_attach_node(ocs, child); - if (ret) { - of_node_put(child); - break; - } + if (ret) + return ret; ret = pnv_php_populate_changeset(ocs, child); - if (ret) { - of_node_put(child); - break; - } + if (ret) + return ret; } - return ret; + return 0; } static void *pnv_php_add_one_pdn(struct device_node *dn, void *data)