]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: pnv_php: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Tue, 17 Mar 2026 13:33:25 +0000 (14:33 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 17 Mar 2026 21:19:03 +0000 (16:19 -0500)
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20260317133322.266102-7-krzysztof.kozlowski@oss.qualcomm.com
drivers/pci/hotplug/pnv_php.c

index 5c020831e318f7d2b7778b46668fee1e571afdd6..ff92a5c301b81db97e1f70e45a0c49894b65458c 100644 (file)
@@ -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)