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

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
...@@ -911,12 +911,13 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -911,12 +911,13 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
} }
aic31xx->p_div = i; 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) &&
if (i == ARRAY_SIZE(aic31xx_divs)) { aic31xx_divs[i].mclk_p != freq/aic31xx->p_div; i++)
dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n", ;
__func__, freq); if (i == ARRAY_SIZE(aic31xx_divs)) {
return -EINVAL; dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
} __func__, freq);
return -EINVAL;
} }
/* set clock on MCLK, BCLK, or GPIO1 as PLL input */ /* set clock on MCLK, BCLK, or GPIO1 as PLL input */
......
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