aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2008-09-13 10:44:29 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-23 02:17:54 -0400
commit9932fbb0b37d13201655b4de2b9acda2f415d83b (patch)
tree2ab00fe5a34f24d1e57d07f566adb5cd53767b88 /sound/pci
parent8569be3cf90c279957bafd4e66f1332f041831d3 (diff)
ALSA: hda: fix oopses in snd-hda-intel after digital slave support additions
Many places fail to check if codec has slave_dig_outs entries (the most common case is not having any entry), leading to various possible oopses in hda_codec code. Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 696d77e575ec..531364d35353 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1462,14 +1462,15 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol,
1462 AC_VERB_SET_DIGI_CONVERT_2, 1462 AC_VERB_SET_DIGI_CONVERT_2,
1463 val >> 8); 1463 val >> 8);
1464 1464
1465 for (d = codec->slave_dig_outs; *d; d++) { 1465 if (codec->slave_dig_outs)
1466 snd_hda_codec_write_cache(codec, *d, 0, 1466 for (d = codec->slave_dig_outs; *d; d++) {
1467 snd_hda_codec_write_cache(codec, *d, 0,
1467 AC_VERB_SET_DIGI_CONVERT_1, 1468 AC_VERB_SET_DIGI_CONVERT_1,
1468 val & 0xff); 1469 val & 0xff);
1469 snd_hda_codec_write_cache(codec, *d, 0, 1470 snd_hda_codec_write_cache(codec, *d, 0,
1470 AC_VERB_SET_DIGI_CONVERT_2, 1471 AC_VERB_SET_DIGI_CONVERT_2,
1471 val >> 8); 1472 val >> 8);
1472 } 1473 }
1473 } 1474 }
1474 1475
1475 mutex_unlock(&codec->spdif_mutex); 1476 mutex_unlock(&codec->spdif_mutex);
@@ -1507,8 +1508,9 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol,
1507 AC_VERB_SET_DIGI_CONVERT_1, 1508 AC_VERB_SET_DIGI_CONVERT_1,
1508 val & 0xff); 1509 val & 0xff);
1509 1510
1510 for (d = codec->slave_dig_outs; *d; d++) 1511 if (codec->slave_dig_outs)
1511 snd_hda_codec_write_cache(codec, *d, 0, 1512 for (d = codec->slave_dig_outs; *d; d++)
1513 snd_hda_codec_write_cache(codec, *d, 0,
1512 AC_VERB_SET_DIGI_CONVERT_1, 1514 AC_VERB_SET_DIGI_CONVERT_1,
1513 val & 0xff); 1515 val & 0xff);
1514 /* unmute amp switch (if any) */ 1516 /* unmute amp switch (if any) */
@@ -1664,8 +1666,9 @@ static int snd_hda_spdif_in_switch_put(struct snd_kcontrol *kcontrol,
1664 snd_hda_codec_write_cache(codec, nid, 0, 1666 snd_hda_codec_write_cache(codec, nid, 0,
1665 AC_VERB_SET_DIGI_CONVERT_1, val); 1667 AC_VERB_SET_DIGI_CONVERT_1, val);
1666 1668
1667 for (d = codec->slave_dig_outs; *d; d++) 1669 if (codec->slave_dig_outs)
1668 snd_hda_codec_write_cache(codec, *d, 0, 1670 for (d = codec->slave_dig_outs; *d; d++)
1671 snd_hda_codec_write_cache(codec, *d, 0,
1669 AC_VERB_SET_DIGI_CONVERT_1, val); 1672 AC_VERB_SET_DIGI_CONVERT_1, val);
1670 } 1673 }
1671 mutex_unlock(&codec->spdif_mutex); 1674 mutex_unlock(&codec->spdif_mutex);
@@ -2617,9 +2620,10 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
2617 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, 2620 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
2618 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); 2621 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff);
2619 2622
2620 for (d = codec->slave_dig_outs; *d; d++) 2623 if (codec->slave_dig_outs)
2621 snd_hda_codec_write(codec, *d, 0, 2624 for (d = codec->slave_dig_outs; *d; d++)
2622 AC_VERB_SET_DIGI_CONVERT_1, 2625 snd_hda_codec_write(codec, *d, 0,
2626 AC_VERB_SET_DIGI_CONVERT_1,
2623 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff); 2627 codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff);
2624 } 2628 }
2625 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); 2629 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
@@ -2628,9 +2632,10 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
2628 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, 2632 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
2629 codec->spdif_ctls & 0xff); 2633 codec->spdif_ctls & 0xff);
2630 2634
2631 for (d = codec->slave_dig_outs; *d; d++) 2635 if (codec->slave_dig_outs)
2632 snd_hda_codec_write(codec, *d, 0, 2636 for (d = codec->slave_dig_outs; *d; d++)
2633 AC_VERB_SET_DIGI_CONVERT_1, 2637 snd_hda_codec_write(codec, *d, 0,
2638 AC_VERB_SET_DIGI_CONVERT_1,
2634 codec->spdif_ctls & 0xff); 2639 codec->spdif_ctls & 0xff);
2635 } 2640 }
2636 2641