diff options
author | Jesper Juhl <jj@chaosbits.net> | 2012-04-12 21:54:34 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-13 11:01:38 +0200 |
commit | 86fc49982369f6918dd9c6eeb70b38ab2303ed0a (patch) | |
tree | 71811d55a58d070407c6d31d32ae93dffd9af508 /sound/soc/codecs/cs42l73.c | |
parent | ASoC: dapm: Ensure power gets managed for line widgets (diff) | |
download | linux-86fc49982369f6918dd9c6eeb70b38ab2303ed0a.tar.xz linux-86fc49982369f6918dd9c6eeb70b38ab2303ed0a.zip |
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: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/cs42l73.c')
-rw-r--r-- | sound/soc/codecs/cs42l73.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 78979b3e0e95..07c44b71f096 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -929,6 +929,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) /* MCLKX -> MCLK */ mclkx_coeff = cs42l73_get_mclkx_coeff(freq); + if (mclkx_coeff < 0) + return mclkx_coeff; mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / cs42l73_mclkx_coeffs[mclkx_coeff].ratio; |