]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ALSA] emu10k1 - Fix handling of ac97_chip=2
authorTakashi Iwai <tiwai@suse.de>
Tue, 4 Oct 2005 11:49:32 +0000 (13:49 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 7 Oct 2005 12:46:34 +0000 (14:46 +0200)
EMU10K1/EMU10K2 driver
Fixed the handling of ac97_chip=2 capability type.
The error occurs in snd_ac97_mixer(), not in snd_ac97_bus().
Also, release the unnecessary ac97_bus object in the error path.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emumixer.c

index 6994f90bb83a033bf31f86cc80d644a51d8cca93..7cc831ccd0cb3fb09fee08deb7c2424f68c5cce5 100644 (file)
@@ -802,21 +802,22 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu,
                        .read = snd_emu10k1_ac97_read,
                };
 
-               if ((err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus)) < 0) {
-                       if (emu->card_capabilities->ac97_chip == 1)
-                               return err;
-                       snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n");
-                       snd_printd(KERN_INFO"          Proceeding without ac97 mixers...\n");
-                       goto no_ac97; /* FIXME: get rid of ugly gotos.. */
-               }
+               if ((err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus)) < 0)
+                       return err;
                pbus->no_vra = 1; /* we don't need VRA */
                
                memset(&ac97, 0, sizeof(ac97));
                ac97.private_data = emu;
                ac97.private_free = snd_emu10k1_mixer_free_ac97;
                ac97.scaps = AC97_SCAP_NO_SPDIF;
-               if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0)
-                       return err;
+               if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) {
+                       if (emu->card_capabilities->ac97_chip == 1)
+                               return err;
+                       snd_printd(KERN_INFO "emu10k1: AC97 is optional on this board\n");
+                       snd_printd(KERN_INFO"          Proceeding without ac97 mixers...\n");
+                       snd_device_free(emu->card, pbus);
+                       goto no_ac97; /* FIXME: get rid of ugly gotos.. */
+               }
                if (emu->audigy) {
                        /* set master volume to 0 dB */
                        snd_ac97_write(emu->ac97, AC97_MASTER, 0x0000);