From e23721e8aff16d2152315c7660d0ef57b2eec5b5 Mon Sep 17 00:00:00 2001 From: phcoder Date: Mon, 8 Jun 2009 23:56:06 +0000 Subject: [PATCH] 2009-06-09 Oliver Henshaw * bus/usb/ohci.c (grub_ohci_pci_iter): Link struct only after initialising controller. * bus/usb/uhci.c (grub_uhci_pci_iter): Likewise. --- ChangeLog | 6 ++++++ bus/usb/ohci.c | 7 ++++--- bus/usb/uhci.c | 6 ++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb9415004..34c5bc18f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-09 Oliver Henshaw + + * bus/usb/ohci.c (grub_ohci_pci_iter): Link struct only after + initialising controller. + * bus/usb/uhci.c (grub_uhci_pci_iter): Likewise. + 2009-06-08 Felix Zielcke * util/i386/pc/grub-install.in: Add a parameter --disk-module diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index ce7ea6efd..53356dc69 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -152,9 +152,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. */ @@ -190,6 +187,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: diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index a0836f805..1c7b8d965 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -174,8 +174,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; @@ -288,6 +286,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: