From 9cadaeedec94f9c698b04ab21d6f8cca7bee2600 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 11 Feb 2002 14:39:57 +0000 Subject: Fix some bugs in the ohci driver with respect to irq setup failure. Submitted by: nyan --- sys/pci/ohci_pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/pci/ohci_pci.c') diff --git a/sys/pci/ohci_pci.c b/sys/pci/ohci_pci.c index 2020ba8..1138d1d 100644 --- a/sys/pci/ohci_pci.c +++ b/sys/pci/ohci_pci.c @@ -233,6 +233,7 @@ ohci_pci_attach(device_t self) (driver_intr_t *) ohci_intr, sc, &sc->ih); if (err) { device_printf(self, "Could not setup irq, %d\n", err); + sc->ih = NULL; ohci_pci_detach(self); return ENXIO; } @@ -266,13 +267,13 @@ ohci_pci_detach(device_t self) bus_space_write_4(sc->iot, sc->ioh, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); - if (sc->irq_res) { + if (sc->irq_res && sc->ih) { int err = bus_teardown_intr(self, sc->irq_res, sc->ih); if (err) /* XXX or should we panic? */ device_printf(self, "Could not tear down irq, %d\n", err); - sc->irq_res = NULL; + sc->ih = NULL; } if (sc->sc_bus.bdev) { @@ -281,7 +282,7 @@ ohci_pci_detach(device_t self) } if (sc->irq_res) { - bus_release_resource(self, SYS_RES_IOPORT, 0, sc->irq_res); + bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); sc->irq_res = NULL; } -- cgit v1.1