[alsa-devel] Fwd: Problems with hda_intel, Santa Rosa, and suspend

Takashi Iwai tiwai at suse.de
Fri Jul 6 11:32:29 CEST 2007


At Thu, 5 Jul 2007 21:42:21 -0500,
Matt Mullins wrote:
> 
> Found what I think is the problem... patch_sigmatel.c set
> spec->num_pins=14, yet spec->pin_nids pointed to stac9205_pin_nids,
> which was an array of only 12 NIDs.  That caused [total guess here]
> either stac92xx_save_bios_config_regs or stac92xx_set_config_regs to
> read past the end of the array and into an uninitialized area.  I
> changed the 14 to a 12, and it seems to work.  The attached patch is
> against the current Mercurial sources, but I made the similar change
> to kernel 2.6.22-rc7, and it doesn't use single_cmd anymore.

Argh!  Thanks for spotting this nasty bug.

It'd be better to use ARRAY_SIZE there.  Then typos would be more
obvious.  Could you check the patch below?

>  It still
> doesn't work after a suspend, though, making me unload and reload the
> module.

Do you mean you'll get a communication error after suspend, or got no
sound output, or any other problem?


thanks,

Takashi

diff -r 42d31b8a307d pci/hda/patch_sigmatel.c
--- a/pci/hda/patch_sigmatel.c	Thu Jul 05 13:10:51 2007 +0200
+++ b/pci/hda/patch_sigmatel.c	Fri Jul 06 11:30:50 2007 +0200
@@ -1958,7 +1958,7 @@ static int patch_stac9200(struct hda_cod
 		return -ENOMEM;
 
 	codec->spec = spec;
-	spec->num_pins = 8;
+	spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
 	spec->pin_nids = stac9200_pin_nids;
 	spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
 							stac9200_models,
@@ -2008,7 +2008,7 @@ static int patch_stac925x(struct hda_cod
 		return -ENOMEM;
 
 	codec->spec = spec;
-	spec->num_pins = 8;
+	spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
 	spec->pin_nids = stac925x_pin_nids;
 	spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
 							stac925x_models,
@@ -2080,7 +2080,7 @@ static int patch_stac922x(struct hda_cod
 		return -ENOMEM;
 
 	codec->spec = spec;
-	spec->num_pins = 10;
+	spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
 	spec->pin_nids = stac922x_pin_nids;
 	spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
 							stac922x_models,
@@ -2181,7 +2181,7 @@ static int patch_stac927x(struct hda_cod
 		return -ENOMEM;
 
 	codec->spec = spec;
-	spec->num_pins = 14;
+	spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
 	spec->pin_nids = stac927x_pin_nids;
 	spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
 							stac927x_models,
@@ -2259,7 +2259,7 @@ static int patch_stac9205(struct hda_cod
 		return -ENOMEM;
 
 	codec->spec = spec;
-	spec->num_pins = 14;
+	spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
 	spec->pin_nids = stac9205_pin_nids;
 	spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
 							stac9205_models,


More information about the Alsa-devel mailing list