ALSA: hda - Clear path indices properly at each re-evaluation
authorTakashi Iwai <tiwai@suse.de>
Mon, 7 Jan 2013 14:07:00 +0000 (15:07 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Jan 2013 07:44:01 +0000 (08:44 +0100)
The path indices must be reset at each evaluation of DAC assignment.
Otherwise the badness value will be wrongly calculated and mixers may
be inconsistently assigned.

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

index 11436c1159535aa4e47d21c073b32cf44bee3822..1b8fd4d6cae9ac7f97ef04e11f987c1ae019e086 100644 (file)
@@ -1138,6 +1138,16 @@ static int fill_and_eval_dacs(struct hda_codec *codec,
        memset(spec->multiout.extra_out_nid, 0, sizeof(spec->multiout.extra_out_nid));
        spec->multi_ios = 0;
        snd_array_free(&spec->paths);
+
+       /* clear path indices */
+       memset(spec->out_paths, 0, sizeof(spec->out_paths));
+       memset(spec->hp_paths, 0, sizeof(spec->hp_paths));
+       memset(spec->speaker_paths, 0, sizeof(spec->speaker_paths));
+       memset(spec->aamix_out_paths, 0, sizeof(spec->aamix_out_paths));
+       memset(spec->digout_paths, 0, sizeof(spec->digout_paths));
+       memset(spec->loopback_paths, 0, sizeof(spec->loopback_paths));
+       memset(&spec->digin_path, 0, sizeof(spec->digin_path));
+
        badness = 0;
 
        /* fill hard-wired DACs first */