Disestablish interrupts if attach fails and bails out.  Interrupts
appear to be disabled until we no longer bail out because of errors.

Is this right?

-m.

Index: ehci_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ehci_pci.c,v
retrieving revision 1.21
diff -u -p -r1.21 ehci_pci.c
--- ehci_pci.c  8 Aug 2010 04:19:24 -0000       1.21
+++ ehci_pci.c  8 Oct 2010 08:42:39 -0000
@@ -186,7 +186,7 @@ ehci_pci_attach(struct device *parent, s
        case PCI_USBREV_1_1:
                sc->sc.sc_bus.usbrev = USBREV_UNKNOWN;
                printf("%s: pre-2.0 USB rev\n", devname);
-               goto unmap_ret;
+               goto disestablish_ret;
        case PCI_USBREV_2_0:
                sc->sc.sc_bus.usbrev = USBREV_2_0;
                break;
@@ -212,7 +212,7 @@ ehci_pci_attach(struct device *parent, s
        r = ehci_init(&sc->sc);
        if (r != USBD_NORMAL_COMPLETION) {
                printf("%s: init failed, error=%d\n", devname, r);
-               goto unmap_ret;
+               goto disestablish_ret;
        }
 
        sc->sc.sc_shutdownhook = shutdownhook_establish(ehci_pci_shutdown, sc);
@@ -224,6 +224,8 @@ ehci_pci_attach(struct device *parent, s
 
        return;
 
+disestablish_ret:
+       pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
 unmap_ret:
        bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
        splx(s);
Index: ohci_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ohci_pci.c,v
retrieving revision 1.36
diff -u -p -r1.36 ohci_pci.c
--- ohci_pci.c  7 Sep 2010 16:21:45 -0000       1.36
+++ ohci_pci.c  8 Oct 2010 08:42:40 -0000
@@ -156,6 +156,7 @@ ohci_pci_attach(struct device *parent, s
        if (ohci_checkrev(&sc->sc) != USBD_NORMAL_COMPLETION ||
            ohci_handover(&sc->sc) != USBD_NORMAL_COMPLETION) {
                bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
+               pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
                splx(s);
                return;
        }
@@ -186,6 +187,7 @@ ohci_pci_attach_deferred(struct device *
                printf("%s: init failed, error=%d\n",
                    sc->sc.sc_bus.bdev.dv_xname, r);
                bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
+               pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
                splx(s);
                return;
        }
Index: uhci_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/uhci_pci.c,v
retrieving revision 1.29
diff -u -p -r1.29 uhci_pci.c
--- uhci_pci.c  29 Jun 2010 22:14:57 -0000      1.29
+++ uhci_pci.c  8 Oct 2010 08:42:40 -0000
@@ -219,6 +219,7 @@ uhci_pci_attach_deferred(struct device *
 
 unmap_ret:
        bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
+       pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
        splx(s);
 }
 

-- 
The Librarian gave him the kind of look other people would reserve for
people who said things like `What's so bad about genocide?'
-- (Terry Pratchett, Guards! Guards!)

Reply via email to