ChangeLog: * bus/usb/ohci.c: Link struct only after initialising controller. * bus/usb/uhci.c: Likewise. Index: bus/usb/ohci.c =================================================================== --- bus/usb/ohci.c (revision 2216) +++ bus/usb/ohci.c (working copy) @@ -153,9 +153,6 @@ grub_ohci_pci_iter (int bus, int device, int func, if (! o) return 1; - /* Link in the OHCI. */ - o->next = ohci; - ohci = o; o->iobase = (grub_uint32_t *) base; /* Reserve memory for the HCCA. */ @@ -189,6 +186,10 @@ grub_ohci_pci_iter (int bus, int device, int func, grub_dprintf ("ohci", "OHCI enable: 0x%02x\n", (grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) >> 6) & 3); + /* link to ohci now that initialisation is successful. */ + o->next = ohci; + ohci = o; + return 0; fail: Index: bus/usb/uhci.c =================================================================== --- bus/usb/uhci.c (revision 2216) +++ bus/usb/uhci.c (working copy) @@ -173,8 +173,6 @@ grub_uhci_pci_iter (int bus, int device, int func, if (! u) return 1; - u->next = uhci; - uhci = u; u->iobase = base & GRUB_UHCI_IOMASK; u->framelist = 0; u->qh = 0; @@ -287,6 +285,10 @@ grub_uhci_pci_iter (int bus, int device, int func, } #endif + /* link to uhci now that initialisation is successful. */ + u->next = uhci; + uhci = u; + return 0; fail: