DF-4552 / fix.diff
--- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -726,6 +726,7 @@ u_int32_t data; char status[SND_STATUSLEN]; u_long midi_start, games_start, count, sdmaa, sdmac, ml, mu; + int mixer_inited = 0; sc = kmalloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->dev = dev; @@ -745,6 +746,7 @@ SV_PCI_ENHANCED_SIZE, RF_ACTIVE); if (sc->enh_reg == NULL) { device_printf(dev, "sv_attach: cannot allocate enh\n"); + kfree(sc, M_DEVBUF); return ENXIO; } sc->enh_st = rman_get_bustag(sc->enh_reg); @@ -790,6 +792,7 @@ device_printf(dev, "sv_attach: Mixer failed to initialize\n"); goto fail; } + mixer_inited = 1; /* XXX This is a hack, and it's ugly. Okay, the deal is this * card has two more io regions that available for automatic @@ -886,6 +889,9 @@ return 0; fail: + if (mixer_inited) + mixer_uninit(dev); /* destroy the live /dev/mixerN before its + * devinfo (sc) loses its bus resources */ if (sc->parent_dmat) bus_dma_tag_destroy(sc->parent_dmat); if (sc->ih) @@ -898,6 +904,7 @@ bus_release_resource(dev, sc->dmaa_type, sc->dmaa_rid, sc->dmaa_reg); if (sc->dmac_reg) bus_release_resource(dev, sc->dmac_type, sc->dmac_rid, sc->dmac_reg); + kfree(sc, M_DEVBUF); return ENXIO; } |