Re: hda_intel (sigmatel) defunct in mmotm 2008-09-13-03-09

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthew Ranostay
Date: Wednesday, September 17, 2008 - 7:09 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jiri Slaby wrote:

Ok, the problem was that codec->slave_dig_outs getting a dereference when NULL.
This has been already fixed in Takashi's sound-2.6.git tree, with the commit id
06efc354f735d5dbbdf4653fc6a8acd489ac5a18.

Thanks,

Matt Ranostay

- ---

# git log pci/hda/hda_codec.c
...
commit 06efc354f735d5dbbdf4653fc6a8acd489ac5a18
Author: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Date:   Sat Sep 13 16:44:29 2008 +0200

    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>
...
# git diff af41e1693fdaa7a3e25cc8dd1ff3180f83487e5a 06efc354f735d5dbbdf4653fc6a8acd489ac5a18 pci/hda/hda_codec.c

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c4fc0d4..0707a8e 100644
- --- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1457,14 +1457,15 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol,
 					  AC_VERB_SET_DIGI_CONVERT_2,
 					  val >> 8);

- -		for (d = codec->slave_dig_outs; *d; d++) {
- -			snd_hda_codec_write_cache(codec, *d, 0,
+		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 & 0xff);
- -			snd_hda_codec_write_cache(codec, *d, 0,
+				snd_hda_codec_write_cache(codec, *d, 0,
 					  AC_VERB_SET_DIGI_CONVERT_2,
 					  val >> 8);
- -		}
+			}
 	}

 	mutex_unlock(&codec->spdif_mutex);
@@ -1502,8 +1503,9 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol,
 					  AC_VERB_SET_DIGI_CONVERT_1,
 					  val & 0xff);

- -		for (d = codec->slave_dig_outs; *d; d++)
- -			snd_hda_codec_write_cache(codec, *d, 0,
+		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 & 0xff);
 		/* unmute amp switch (if any) */
@@ -1659,8 +1661,9 @@ 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);

- -		for (d = codec->slave_dig_outs; *d; d++)
- -			snd_hda_codec_write_cache(codec, *d, 0,
+		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);
 	}
 	mutex_unlock(&codec->spdif_mutex);
@@ -2610,9 +2613,10 @@ 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);

- -		for (d = codec->slave_dig_outs; *d; d++)
- -			snd_hda_codec_write(codec, *d, 0,
- -					AC_VERB_SET_DIGI_CONVERT_1,
+		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,
 				    codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff);
 	}
 	snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
@@ -2621,9 +2625,10 @@ 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);

- -		for (d = codec->slave_dig_outs; *d; d++)
- -			snd_hda_codec_write(codec, *d, 0,
- -					AC_VERB_SET_DIGI_CONVERT_1,
+		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,
 				    codec->spdif_ctls & 0xff);
 	}






-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjRD48ACgkQ7s2wy7nhBHWlwwCgn3aWMATxTWYnMnnAhAE8NjzE
sEoAn0GIFSiv2Y0RugBFyi00MVYHNmu5
=DLwd
-----END PGP SIGNATURE-----
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: hda_intel (sigmatel) defunct in mmotm 2008-09-13-03-09, Matthew Ranostay, (Mon Sep 15, 7:16 am)
Re: hda_intel (sigmatel) defunct in mmotm 2008-09-13-03-09, Matthew Ranostay, (Tue Sep 16, 7:43 am)
Re: hda_intel (sigmatel) defunct in mmotm 2008-09-13-03-09, Matthew Ranostay, (Wed Sep 17, 7:09 am)
suspend (uhci_hcd) defunct in mmotm 2008-09-13-03-09, Jiri Slaby, (Wed Sep 17, 9:46 am)
[PATCH] PM: use pm_op methods for device types, Alan Stern, (Thu Sep 25, 2:07 pm)
Re: [PATCH] PM: use pm_op methods for device types, Rafael J. Wysocki, (Thu Sep 25, 2:27 pm)
Re: [PATCH] PM: use pm_op methods for device types, Alan Stern, (Fri Sep 26, 6:56 am)
Re: [PATCH] PM: use pm_op methods for device types, Pavel Machek, (Mon Oct 6, 8:11 am)