提交 86fc4998 编写于 作者: J Jesper Juhl 提交者: Mark Brown

ASoC: cs42l73: don't use negative array index

If cs42l73_get_mclkx_coeff() returns < 0 (which it can) in
sound/soc/codecs/cs42l73.c::cs42l73_set_mclk(), then we'll be using
the (negative) return value as array index on the very next line of
code - that's bad.

Catch the negative return value and propagate it to the caller (which
checks for it) and things are a bit more sane :-)
Signed-off-by: NJesper Juhl <jj@chaosbits.net>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 7e1f7c8a
...@@ -929,6 +929,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) ...@@ -929,6 +929,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq)
/* MCLKX -> MCLK */ /* MCLKX -> MCLK */
mclkx_coeff = cs42l73_get_mclkx_coeff(freq); mclkx_coeff = cs42l73_get_mclkx_coeff(freq);
if (mclkx_coeff < 0)
return mclkx_coeff;
mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx /
cs42l73_mclkx_coeffs[mclkx_coeff].ratio; cs42l73_mclkx_coeffs[mclkx_coeff].ratio;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册