aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9543bc8aaef..80d6add8a62 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec)
1604static void alc_auto_parse_digital(struct hda_codec *codec) 1604static void alc_auto_parse_digital(struct hda_codec *codec)
1605{ 1605{
1606 struct alc_spec *spec = codec->spec; 1606 struct alc_spec *spec = codec->spec;
1607 int i, err; 1607 int i, err, nums;
1608 hda_nid_t dig_nid; 1608 hda_nid_t dig_nid;
1609 1609
1610 /* support multiple SPDIFs; the secondary is set up as a slave */ 1610 /* support multiple SPDIFs; the secondary is set up as a slave */
1611 nums = 0;
1611 for (i = 0; i < spec->autocfg.dig_outs; i++) { 1612 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1612 hda_nid_t conn[4]; 1613 hda_nid_t conn[4];
1613 err = snd_hda_get_connections(codec, 1614 err = snd_hda_get_connections(codec,
1614 spec->autocfg.dig_out_pins[i], 1615 spec->autocfg.dig_out_pins[i],
1615 conn, ARRAY_SIZE(conn)); 1616 conn, ARRAY_SIZE(conn));
1616 if (err < 0) 1617 if (err <= 0)
1617 continue; 1618 continue;
1618 dig_nid = conn[0]; /* assume the first element is audio-out */ 1619 dig_nid = conn[0]; /* assume the first element is audio-out */
1619 if (!i) { 1620 if (!nums) {
1620 spec->multiout.dig_out_nid = dig_nid; 1621 spec->multiout.dig_out_nid = dig_nid;
1621 spec->dig_out_type = spec->autocfg.dig_out_type[0]; 1622 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1622 } else { 1623 } else {
1623 spec->multiout.slave_dig_outs = spec->slave_dig_outs; 1624 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1624 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) 1625 if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1625 break; 1626 break;
1626 spec->slave_dig_outs[i - 1] = dig_nid; 1627 spec->slave_dig_outs[nums - 1] = dig_nid;
1627 } 1628 }
1629 nums++;
1628 } 1630 }
1629 1631
1630 if (spec->autocfg.dig_in_pin) { 1632 if (spec->autocfg.dig_in_pin) {