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>
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 */
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 */