Make sure the PCI device list is ordered in bus order.
Don't iterate past the end of the list when detecting EHCI devices.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
}
memset(dev, 0, sizeof(*dev));
hlist_add(&dev->node, pprev);
+ pprev = &dev->node.next;
count++;
// Find parent device.
}
if (ehcipci->class == PCI_CLASS_SERIAL_USB)
found++;
- ehcipci = container_of(
+ ehcipci = container_of_or_null(
ehcipci->node.next, struct pci_device, node);
if (!ehcipci || (pci_bdf_to_busdev(ehcipci->bdf)
!= pci_bdf_to_busdev(pci->bdf)))