[alsa-devel] [PATCH 1/1] ASoC: core: cache index fix

Takashi Iwai tiwai at suse.de
Tue Aug 2 12:38:59 CEST 2011


At Tue, 2 Aug 2011 11:51:41 +0200,
Wolfram Sang wrote:
> 
> @@ -1023,12 +981,10 @@ static int sgtl5000_suspend(struct snd_soc_codec *codec, pm_message_t state)
>  static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
>  {
>  	u16 *cache = codec->reg_cache;
> -	int i;
> -	int regular_regs = SGTL5000_CHIP_SHORT_CTRL >> 1;
> +	u16 reg;
>  
>  	/* restore regular registers */
> -	for (i = 0; i < regular_regs; i++) {
> -		int reg = i << 1;
> +	for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {

Heh, this exposed another bug in the original code :)
It should have been
	for (i = 0; i <= regular_regs; i++) {


thanks,

Takashi


More information about the Alsa-devel mailing list