DF-4299 / fix.diff
--- a/sys/dev/sound/pci/emu10kx-pcm.c +++ b/sys/dev/sound/pci/emu10kx-pcm.c @@ -1338,6 +1338,7 @@ static int emu_pcm_attach(device_t dev) { struct emu_pcm_info *sc; + int mixer_inited = 0; unsigned int i; char status[SND_STATUSLEN]; uint32_t inte, ipr; @@ -1396,6 +1397,7 @@ emu_pcm_attach(device_t dev) sc->ac97_mixerclass = ac97_getmixerclass(); if (mixer_init(dev, &emudspmixer_class, sc)) { device_printf(dev, "failed to initialize DSP mixer\n"); goto bad; } + mixer_inited = 1; break; case RT_REAR: @@ -1406,6 +1408,7 @@ emu_pcm_attach(device_t dev) sc->rt_mono.amounts_left[3] = 0xff; if (mixer_init(dev, &emudspmixer_class, sc)) { device_printf(dev, "failed to initialize mixer\n"); goto bad; } + mixer_inited = 1; break; case RT_CENTER: @@ -1414,6 +1417,7 @@ emu_pcm_attach(device_t dev) sc->rt_mono.amounts_left[4] = 0xff; if (mixer_init(dev, &emudspmixer_class, sc)) { device_printf(dev, "failed to initialize mixer\n"); goto bad; } + mixer_inited = 1; break; case RT_SUB: @@ -1422,6 +1426,7 @@ emu_pcm_attach(device_t dev) sc->rt_mono.amounts_left[5] = 0xff; if (mixer_init(dev, &emudspmixer_class, sc)) { device_printf(dev, "failed to initialize mixer\n"); goto bad; } + mixer_inited = 1; break; case RT_SIDE: @@ -1430,6 +1435,7 @@ emu_pcm_attach(device_t dev) sc->rt_mono.amounts_left[7] = 0xff; if (mixer_init(dev, &emudspmixer_class, sc)) { device_printf(dev, "failed to initialize mixer\n"); goto bad; } + mixer_inited = 1; break; case RT_MCHRECORD: if (mixer_init(dev, &emuefxmixer_class, sc)) { device_printf(dev, "failed to initialize EFX mixer\n"); goto bad; } + mixer_inited = 1; break; @@ -1486,6 +1492,10 @@ emu_pcm_attach(device_t dev) return (0); bad: + if (sc->ihandle >= 0) + (void)emu_intr_unregister(sc->card, sc->ihandle); + if (mixer_inited) + (void)mixer_uninit(dev); if (sc->codec) ac97_destroy(sc->codec); if (sc->lock) |