diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2000-01-31 14:05:21 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2000-01-31 14:05:21 +0000 |
commit | 576210bc48d1918c6a283f510060b0e19fce1a1b (patch) | |
tree | 1a0984a57549db91ac818e6995a5c07b8c142b3b /sys/dev | |
parent | 84567babad5cce22315b6b47244e853b80fda74d (diff) | |
download | FreeBSD-src-576210bc48d1918c6a283f510060b0e19fce1a1b.zip FreeBSD-src-576210bc48d1918c6a283f510060b0e19fce1a1b.tar.gz |
bus_release_resource is spellt like bus_release_resource not like
bus_delete_resource.
Fixes a problem when the probe succeeded, but the attach failed. The
release of the resources was done inproperly.
Approved by: jkh
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/ohci_pci.c | 26 | ||||
-rw-r--r-- | sys/dev/usb/uhci_pci.c | 26 |
2 files changed, 26 insertions, 26 deletions
diff --git a/sys/dev/usb/ohci_pci.c b/sys/dev/usb/ohci_pci.c index cb19f36..591f665 100644 --- a/sys/dev/usb/ohci_pci.c +++ b/sys/dev/usb/ohci_pci.c @@ -146,7 +146,7 @@ ohci_pci_attach(device_t self) ohci_softc_t *sc = device_get_softc(self); int err; int rid; - struct resource *res; + struct resource *io_res, *irq_res; void *ih; int intr; @@ -154,20 +154,20 @@ ohci_pci_attach(device_t self) sc->sc_bus.usbrev = USBREV_1_0; rid = PCI_CBMEM; - res = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, - 0, ~0, 1, RF_ACTIVE); - if (!res) { + io_res = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, + 0, ~0, 1, RF_ACTIVE); + if (!io_res) { device_printf(self, "could not map memory\n"); return ENXIO; } - sc->iot = rman_get_bustag(res); - sc->ioh = rman_get_bushandle(res); + sc->iot = rman_get_bustag(io_res); + sc->ioh = rman_get_bushandle(io_res); rid = 0; - res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, - RF_SHAREABLE | RF_ACTIVE); - if (res == NULL) { + irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, + RF_SHAREABLE | RF_ACTIVE); + if (irq_res == NULL) { device_printf(self, "could not allocate irq\n"); err = ENOMEM; goto bad1; @@ -222,7 +222,7 @@ ohci_pci_attach(device_t self) goto bad3; } - err = BUS_SETUP_INTR(parent, self, res, INTR_TYPE_BIO, + err = BUS_SETUP_INTR(parent, self, irq_res, INTR_TYPE_BIO, (driver_intr_t *) ohci_intr, sc, &ih); if (err) { device_printf(self, "could not setup irq, %d\n", err); @@ -247,16 +247,16 @@ bad4: bus_space_write_4(sc->iot, sc->ioh, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); - err = BUS_TEARDOWN_INTR(parent, self, res, ih); + err = BUS_TEARDOWN_INTR(parent, self, irq_res, ih); if (err) /* XXX or should we panic? */ device_printf(self, "could not tear down irq, %d\n", err); bad3: device_delete_child(self, sc->sc_bus.bdev); bad2: - bus_delete_resource(self, SYS_RES_IOPORT, 0); + bus_release_resource(self, SYS_RES_IOPORT, 0, irq_res); bad1: - bus_delete_resource(self, SYS_RES_MEMORY, PCI_CBMEM); + bus_release_resource(self, SYS_RES_MEMORY, PCI_CBMEM, io_res); return err; } diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c index f12355c..d635b07 100644 --- a/sys/dev/usb/uhci_pci.c +++ b/sys/dev/usb/uhci_pci.c @@ -153,29 +153,29 @@ uhci_pci_attach(device_t self) device_t parent = device_get_parent(self); int rid; void *ih; - struct resource *res; + struct resource *io_res, *irq_res; int intr; int legsup; int err; rid = PCI_UHCI_BASE_REG; - res = bus_alloc_resource(self, SYS_RES_IOPORT, &rid, - 0, ~0, 1, RF_ACTIVE); - if (!res) { + io_res = bus_alloc_resource(self, SYS_RES_IOPORT, &rid, + 0, ~0, 1, RF_ACTIVE); + if (!io_res) { device_printf(self, "could not map ports\n"); return ENXIO; } - sc->iot = rman_get_bustag(res); - sc->ioh = rman_get_bushandle(res); + sc->iot = rman_get_bustag(io_res); + sc->ioh = rman_get_bushandle(io_res); /* disable interrupts */ bus_space_write_2(sc->iot, sc->ioh, UHCI_INTR, 0); rid = 0; - res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, - RF_SHAREABLE | RF_ACTIVE); - if (res == NULL) { + irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, + RF_SHAREABLE | RF_ACTIVE); + if (irq_res == NULL) { device_printf(self, "could not allocate irq\n"); err = ENOMEM; goto bad1; @@ -229,7 +229,7 @@ uhci_pci_attach(device_t self) goto bad3; } - err = BUS_SETUP_INTR(parent, self, res, INTR_TYPE_BIO, + err = BUS_SETUP_INTR(parent, self, irq_res, INTR_TYPE_BIO, (driver_intr_t *) uhci_intr, sc, &ih); if (err) { device_printf(self, "could not setup irq, %d\n", err); @@ -265,7 +265,7 @@ bad4: */ bus_space_write_2(sc->iot, sc->ioh, UHCI_INTR, 0); - err = BUS_TEARDOWN_INTR(parent, self, res, ih); + err = BUS_TEARDOWN_INTR(parent, self, irq_res, ih); if (err) /* XXX or should we panic? */ device_printf(self, "could not tear down irq, %d\n", @@ -274,9 +274,9 @@ bad4: bad3: device_delete_child(self, sc->sc_bus.bdev); bad2: - bus_delete_resource(self, SYS_RES_IRQ, 0); + bus_release_resource(self, SYS_RES_IRQ, 0, irq_res); bad1: - bus_delete_resource(self, SYS_RES_IOPORT, PCI_UHCI_BASE_REG); + bus_release_resource(self, SYS_RES_IOPORT, PCI_UHCI_BASE_REG, io_res); return err; } |