summaryrefslogtreecommitdiffstats
path: root/sys/pci/ohci_pci.c
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-02-11 14:39:57 +0000
committerjoe <joe@FreeBSD.org>2002-02-11 14:39:57 +0000
commit9cadaeedec94f9c698b04ab21d6f8cca7bee2600 (patch)
treeb8c916b3e2bd60a17ed74f85faec42fea0ceb719 /sys/pci/ohci_pci.c
parent570d74127d12bed0a8a0505b828d0f9bfbc6d738 (diff)
downloadFreeBSD-src-9cadaeedec94f9c698b04ab21d6f8cca7bee2600.zip
FreeBSD-src-9cadaeedec94f9c698b04ab21d6f8cca7bee2600.tar.gz
Fix some bugs in the ohci driver with respect to irq setup failure.
Submitted by: nyan
Diffstat (limited to 'sys/pci/ohci_pci.c')
-rw-r--r--sys/pci/ohci_pci.c7
1 files changed, 4 insertions, 3 deletions
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;
}
OpenPOWER on IntegriCloud