On Tue, 17 Mar 2026, Krzysztof Kozlowski wrote:

> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Reviewed-by: Jonathan Cameron <[email protected]>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> 
> ---
> 
> Changes in v2:
> Tags
> ---
>  drivers/pci/hotplug/rpaphp_slot.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/rpaphp_slot.c 
> b/drivers/pci/hotplug/rpaphp_slot.c
> index 33ca19200c1b..67362e5b9971 100644
> --- a/drivers/pci/hotplug/rpaphp_slot.c
> +++ b/drivers/pci/hotplug/rpaphp_slot.c
> @@ -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;
>               }
>       }
> 

Reviewed-by: Ilpo Järvinen <[email protected]>

-- 
 i.

Reply via email to