]> xenbits.xensource.com Git - seabios.git/commitdiff
Fix USB EHCI detection that was broken in hlist conversion of PCIDevices.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 14 Jul 2013 17:55:52 +0000 (13:55 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 14 Jul 2013 17:55:52 +0000 (13:55 -0400)
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>
src/pci.c
src/usb.c

index 6163a2923636fcd0fa90b4b3fc1e89cb6230f447..dc62c5c231296cc8732829ec9399dd36053d68e3 100644 (file)
--- 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.
index ecccd758b636812b535d033547927390cb38fb20..42541ff3db9af4730ecaf3c8480c797d82569cb0 100644 (file)
--- 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)))