On 5/15/26 07:22, Gerd Bayer wrote:
>  static int __init pcibios_assign_resources(void)
>  {
> -     struct pci_bus *bus;
> +     struct pci_bus *bus = NULL;
>  
>       if (!(pci_probe & PCI_ASSIGN_ROMS))
> -             list_for_each_entry(bus, &pci_root_buses, node)
> +             while ((bus = pci_find_next_bus(bus)) != NULL)
>                       pcibios_allocate_rom_resources(bus);

What's with the 'bus = NULL'? I thought there was some crazy macro magic
going on or something, but pci_find_next_bus() looks like a normal
function that's just taking a pointer and not _modifying_ the pointer value.

Also, wouldn't this be a more readable way of writing what you have?

        while (bus = pci_find_next_bus(bus))

For that matter isn't the kernel idiom for these things:

        for_each_pci_bus(bus) {
                // do bus stuff
        }

I'm kinda surprised there isn't one of those already.

Reply via email to