Commit bbc686b3 authored by Jyri Sarha's avatar Jyri Sarha Committed by Mark Brown
Browse files

ASoC: tlv320aic31xx: Fix off by one error in the loop stucture.



Fix off by one read beyond the end of a table.

Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarJyri Sarha <jsarha@ti.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
parent f114040e
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -911,13 +911,14 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
	}
	aic31xx->p_div = i;

	for (i = 0; aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++) {
	for (i = 0; i < ARRAY_SIZE(aic31xx_divs) &&
		     aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++)
		;
	if (i == ARRAY_SIZE(aic31xx_divs)) {
		dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
			__func__, freq);
		return -EINVAL;
	}
	}

	/* set clock on MCLK, BCLK, or GPIO1 as PLL input */
	snd_soc_update_bits(codec, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK,