summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTaylor Hutt <thutt@chromium.org>2011-05-18 05:03:54 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-18 20:33:27 +0400
commit539494253547d078089cc15490e83f6e5f2e7213 (patch)
treea7403953e75a747ab85f896f93e9e5b464efe225 /sound
parent34e268d87d60da7968d7300aae7d575be9d16ae7 (diff)
downloadlinux-539494253547d078089cc15490e83f6e5f2e7213.tar.xz
ASoC: Max98095: Move existing NULL check before pointer dereference.
Visual inspection shows that max98095_put_eq_enum() and max98095_put_bq_enum() each have a possible NULL deref of 'pdata'. This change moves the NULL check above the use. Signed-off-by: Taylor Hutt <thutt@chromium.org> Acked-by: Peter Hsiang <Peter.Hsiang@maxim-ic.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/max98095.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index a6cc94e1750b..e1d282d477da 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -1872,16 +1872,14 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
BUG_ON(channel > 1);
- cdata = &max98095->dai[channel];
+ if (!pdata || !max98095->eq_textcnt)
+ return 0;
if (sel >= pdata->eq_cfgcnt)
return -EINVAL;
+ cdata = &max98095->dai[channel];
cdata->eq_sel = sel;
-
- if (!pdata || !max98095->eq_textcnt)
- return 0;
-
fs = cdata->rate;
/* Find the selected configuration with nearest sample rate */
@@ -2020,16 +2018,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
BUG_ON(channel > 1);
- cdata = &max98095->dai[channel];
+ if (!pdata || !max98095->bq_textcnt)
+ return 0;
if (sel >= pdata->bq_cfgcnt)
return -EINVAL;
+ cdata = &max98095->dai[channel];
cdata->bq_sel = sel;
-
- if (!pdata || !max98095->bq_textcnt)
- return 0;
-
fs = cdata->rate;
/* Find the selected configuration with nearest sample rate */