diff options
author | Taylor Hutt <thutt@chromium.org> | 2011-05-17 21:03:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-05-18 12:33:27 -0400 |
commit | 539494253547d078089cc15490e83f6e5f2e7213 (patch) | |
tree | a7403953e75a747ab85f896f93e9e5b464efe225 | |
parent | 34e268d87d60da7968d7300aae7d575be9d16ae7 (diff) |
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>
-rw-r--r-- | sound/soc/codecs/max98095.c | 16 |
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, | |||
1872 | 1872 | ||
1873 | BUG_ON(channel > 1); | 1873 | BUG_ON(channel > 1); |
1874 | 1874 | ||
1875 | cdata = &max98095->dai[channel]; | 1875 | if (!pdata || !max98095->eq_textcnt) |
1876 | return 0; | ||
1876 | 1877 | ||
1877 | if (sel >= pdata->eq_cfgcnt) | 1878 | if (sel >= pdata->eq_cfgcnt) |
1878 | return -EINVAL; | 1879 | return -EINVAL; |
1879 | 1880 | ||
1881 | cdata = &max98095->dai[channel]; | ||
1880 | cdata->eq_sel = sel; | 1882 | cdata->eq_sel = sel; |
1881 | |||
1882 | if (!pdata || !max98095->eq_textcnt) | ||
1883 | return 0; | ||
1884 | |||
1885 | fs = cdata->rate; | 1883 | fs = cdata->rate; |
1886 | 1884 | ||
1887 | /* Find the selected configuration with nearest sample rate */ | 1885 | /* Find the selected configuration with nearest sample rate */ |
@@ -2020,16 +2018,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, | |||
2020 | 2018 | ||
2021 | BUG_ON(channel > 1); | 2019 | BUG_ON(channel > 1); |
2022 | 2020 | ||
2023 | cdata = &max98095->dai[channel]; | 2021 | if (!pdata || !max98095->bq_textcnt) |
2022 | return 0; | ||
2024 | 2023 | ||
2025 | if (sel >= pdata->bq_cfgcnt) | 2024 | if (sel >= pdata->bq_cfgcnt) |
2026 | return -EINVAL; | 2025 | return -EINVAL; |
2027 | 2026 | ||
2027 | cdata = &max98095->dai[channel]; | ||
2028 | cdata->bq_sel = sel; | 2028 | cdata->bq_sel = sel; |
2029 | |||
2030 | if (!pdata || !max98095->bq_textcnt) | ||
2031 | return 0; | ||
2032 | |||
2033 | fs = cdata->rate; | 2029 | fs = cdata->rate; |
2034 | 2030 | ||
2035 | /* Find the selected configuration with nearest sample rate */ | 2031 | /* Find the selected configuration with nearest sample rate */ |