]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: rpaphp: Simplify with scoped for each OF child loop
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Tue, 17 Mar 2026 13:33:26 +0000 (14:33 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 17 Mar 2026 21:19:21 +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-8-krzysztof.kozlowski@oss.qualcomm.com
drivers/pci/hotplug/rpaphp_slot.c

index 33ca19200c1b5cc4f628f62e9666732f007a2c2f..67362e5b99719e1f849f36df48eea36559d79eeb 100644 (file)
@@ -82,7 +82,6 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
 int rpaphp_register_slot(struct slot *slot)
 {
        struct hotplug_slot *php_slot = &slot->hotplug_slot;
-       struct device_node *child;
        u32 my_index;
        int retval;
        int slotno = -1;
@@ -97,11 +96,10 @@ int rpaphp_register_slot(struct slot *slot)
                return -EAGAIN;
        }
 
-       for_each_child_of_node(slot->dn, child) {
+       for_each_child_of_node_scoped(slot->dn, child) {
                retval = of_property_read_u32(child, "ibm,my-drc-index", &my_index);
                if (my_index == slot->index) {
                        slotno = PCI_SLOT(PCI_DN(child)->devfn);
-                       of_node_put(child);
                        break;
                }
        }