Commit 9932fbb0 authored by Herton Ronaldo Krzesinski's avatar Herton Ronaldo Krzesinski Committed by Jaroslav Kysela

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: default avatarHerton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 8569be3c
......@@ -1462,6 +1462,7 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol,
AC_VERB_SET_DIGI_CONVERT_2,
val >> 8);
if (codec->slave_dig_outs)
for (d = codec->slave_dig_outs; *d; d++) {
snd_hda_codec_write_cache(codec, *d, 0,
AC_VERB_SET_DIGI_CONVERT_1,
......@@ -1507,6 +1508,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol,
AC_VERB_SET_DIGI_CONVERT_1,
val & 0xff);
if (codec->slave_dig_outs)
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_write_cache(codec, *d, 0,
AC_VERB_SET_DIGI_CONVERT_1,
......@@ -1664,6 +1666,7 @@ static int snd_hda_spdif_in_switch_put(struct snd_kcontrol *kcontrol,
snd_hda_codec_write_cache(codec, nid, 0,
AC_VERB_SET_DIGI_CONVERT_1, val);
if (codec->slave_dig_outs)
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_write_cache(codec, *d, 0,
AC_VERB_SET_DIGI_CONVERT_1, val);
......@@ -2617,6 +2620,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff);
if (codec->slave_dig_outs)
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_write(codec, *d, 0,
AC_VERB_SET_DIGI_CONVERT_1,
......@@ -2628,6 +2632,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
codec->spdif_ctls & 0xff);
if (codec->slave_dig_outs)
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_write(codec, *d, 0,
AC_VERB_SET_DIGI_CONVERT_1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment