From: Takashi Iwai Date: Wed, 30 Oct 2013 07:35:07 +0000 (+0100) Subject: ASoC: wm8996: Fix negative array index read X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fe329a1a92cfe2d0c7e04fe3bc63761dc0f35950;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ASoC: wm8996: Fix negative array index read Spotted by coverity CID 146355. Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 46fe83d2b224..b70379ebd142 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -438,6 +438,8 @@ static int wm8996_get_retune_mobile_enum(struct snd_kcontrol *kcontrol, struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); int block = wm8996_get_retune_mobile_block(kcontrol->id.name); + if (block < 0) + return block; ucontrol->value.enumerated.item[0] = wm8996->retune_mobile_cfg[block]; return 0;