ASoC: ml26124: Fix negative array index read

get_coeff() may return an error.

Spotted by coverity CID 703394.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Takashi Iwai 2013-10-30 18:40:04 +01:00 committed by Mark Brown
parent 959f58544b
commit 8b4b30365c
1 changed files with 2 additions and 0 deletions

View File

@ -342,6 +342,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec);
int i = get_coeff(priv->mclk, params_rate(hw_params));
if (i < 0)
return i;
priv->substream = substream;
priv->rate = params_rate(hw_params);