Commit 53949425 authored by Taylor Hutt's avatar Taylor Hutt Committed by Mark Brown

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: default avatarTaylor Hutt <thutt@chromium.org>
Acked-by: default avatarPeter Hsiang <Peter.Hsiang@maxim-ic.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 34e268d8
...@@ -1872,16 +1872,14 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, ...@@ -1872,16 +1872,14 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
BUG_ON(channel > 1); BUG_ON(channel > 1);
cdata = &max98095->dai[channel]; if (!pdata || !max98095->eq_textcnt)
return 0;
if (sel >= pdata->eq_cfgcnt) if (sel >= pdata->eq_cfgcnt)
return -EINVAL; return -EINVAL;
cdata = &max98095->dai[channel];
cdata->eq_sel = sel; cdata->eq_sel = sel;
if (!pdata || !max98095->eq_textcnt)
return 0;
fs = cdata->rate; fs = cdata->rate;
/* Find the selected configuration with nearest sample rate */ /* Find the selected configuration with nearest sample rate */
...@@ -2020,16 +2018,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, ...@@ -2020,16 +2018,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
BUG_ON(channel > 1); BUG_ON(channel > 1);
cdata = &max98095->dai[channel]; if (!pdata || !max98095->bq_textcnt)
return 0;
if (sel >= pdata->bq_cfgcnt) if (sel >= pdata->bq_cfgcnt)
return -EINVAL; return -EINVAL;
cdata = &max98095->dai[channel];
cdata->bq_sel = sel; cdata->bq_sel = sel;
if (!pdata || !max98095->bq_textcnt)
return 0;
fs = cdata->rate; fs = cdata->rate;
/* Find the selected configuration with nearest sample rate */ /* Find the selected configuration with nearest sample rate */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment