Release memory resource on cuda driver attach failure.

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
This commit is contained in:
mav 2018-04-19 15:29:10 +00:00
parent d7f6d056cb
commit e45770f056

View File

@ -165,12 +165,16 @@ cuda_attach(device_t dev)
RF_ACTIVE); RF_ACTIVE);
if (sc->sc_irq == NULL) { if (sc->sc_irq == NULL) {
device_printf(dev, "could not allocate interrupt\n"); device_printf(dev, "could not allocate interrupt\n");
bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_memrid,
sc->sc_memr);
return (ENXIO); return (ENXIO);
} }
if (bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE if (bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE
| INTR_ENTROPY, NULL, cuda_intr, dev, &sc->sc_ih) != 0) { | INTR_ENTROPY, NULL, cuda_intr, dev, &sc->sc_ih) != 0) {
device_printf(dev, "could not setup interrupt\n"); device_printf(dev, "could not setup interrupt\n");
bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_memrid,
sc->sc_memr);
bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqrid, bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqrid,
sc->sc_irq); sc->sc_irq);
return (ENXIO); return (ENXIO);