提交 5b376195 编写于 作者: T Takashi Iwai

ALSA: hda - Fix empty DAC filling in patch_via.c

In via_auto_fill_adc_nids(), the parser tries to fill dac_nids[] at
the point of the current line-out (i).  When no valid path is found
for this output, this results in dac = 0, thus it creates a hole in
dac_nids[].  This confuses is_empty_dac() and trims the detected DAC
in later reference.

This patch fixes the bug by appending DAC properly to dac_nids[] in
via_auto_fill_adc_nids().
Reported-by: NMassimo Del Fedele <max@veneto.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 ae24c319
...@@ -1809,11 +1809,11 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec) ...@@ -1809,11 +1809,11 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec)
{ {
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
const struct auto_pin_cfg *cfg = &spec->autocfg; const struct auto_pin_cfg *cfg = &spec->autocfg;
int i, dac_num; int i;
hda_nid_t nid; hda_nid_t nid;
spec->multiout.num_dacs = 0;
spec->multiout.dac_nids = spec->private_dac_nids; spec->multiout.dac_nids = spec->private_dac_nids;
dac_num = 0;
for (i = 0; i < cfg->line_outs; i++) { for (i = 0; i < cfg->line_outs; i++) {
hda_nid_t dac = 0; hda_nid_t dac = 0;
nid = cfg->line_out_pins[i]; nid = cfg->line_out_pins[i];
...@@ -1824,16 +1824,13 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec) ...@@ -1824,16 +1824,13 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec)
if (!i && parse_output_path(codec, nid, dac, 1, if (!i && parse_output_path(codec, nid, dac, 1,
&spec->out_mix_path)) &spec->out_mix_path))
dac = spec->out_mix_path.path[0]; dac = spec->out_mix_path.path[0];
if (dac) { if (dac)
spec->private_dac_nids[i] = dac; spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
dac_num++;
}
} }
if (!spec->out_path[0].depth && spec->out_mix_path.depth) { if (!spec->out_path[0].depth && spec->out_mix_path.depth) {
spec->out_path[0] = spec->out_mix_path; spec->out_path[0] = spec->out_mix_path;
spec->out_mix_path.depth = 0; spec->out_mix_path.depth = 0;
} }
spec->multiout.num_dacs = dac_num;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册