aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2013-05-28 05:36:42 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-28 10:36:45 -0400
commit7d6898be8db92450ce7a0afcc4238680b9703e2b (patch)
tree7e83f95ad6b93aa1fe1857f12a6590bbb4946fab /sound/soc
parent9767a58b8b2a0b153c246fb6306c7d48d51bb379 (diff)
ASoC: wm8994: check for array index returned
The array 'drc_cfg' of size 3 may use index value -22 (EINVAL) The array 'retune_mobile_cfg' of size 3 may use index value -22 (EINVAL) Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8994.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index b38382cc4b59..dfd997aaadfc 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -383,6 +383,8 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
383 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 383 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
384 int drc = wm8994_get_drc(kcontrol->id.name); 384 int drc = wm8994_get_drc(kcontrol->id.name);
385 385
386 if (drc < 0)
387 return drc;
386 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; 388 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc];
387 389
388 return 0; 390 return 0;
@@ -488,6 +490,9 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
488 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 490 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
489 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 491 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
490 492
493 if (block < 0)
494 return block;
495
491 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; 496 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block];
492 497
493 return 0; 498 return 0;