From 2a9aeabdfb34374ecac25e7a8d21c9e368618cd4 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 14 Jul 2013 13:55:52 -0400 Subject: [PATCH] Fix USB EHCI detection that was broken in hlist conversion of PCIDevices. 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 --- src/pci.c | 1 + src/usb.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pci.c b/src/pci.c index 6163a29..dc62c5c 100644 --- a/src/pci.c +++ b/src/pci.c @@ -122,6 +122,7 @@ pci_probe_devices(void) } memset(dev, 0, sizeof(*dev)); hlist_add(&dev->node, pprev); + pprev = &dev->node.next; count++; // Find parent device. diff --git a/src/usb.c b/src/usb.c index ecccd75..42541ff 100644 --- a/src/usb.c +++ b/src/usb.c @@ -444,7 +444,7 @@ usb_setup(void) } 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))) -- 2.39.5