ASoC: Max98095: Move existing NULL check before pointer dereference.
Taylor Hutt [Wed, 18 May 2011 01:03:54 +0000 (18:03 -0700)]
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>
(cherry picked from commit 539494253547d078089cc15490e83f6e5f2e7213)

Change-Id: I587b8d2ea14cdf8ce33a4319b6c2ba3a4df067aa
Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-on: http://git-master/r/69963
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

sound/soc/codecs/max98095.c

index 48071dc..668434d 100644 (file)
@@ -1878,7 +1878,6 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
 
        cdata = &max98095->dai[channel];
        cdata->eq_sel = sel;
-
        fs = cdata->rate;
 
        /* Find the selected configuration with nearest sample rate */
@@ -2025,7 +2024,6 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
 
        cdata = &max98095->dai[channel];
        cdata->bq_sel = sel;
-
        fs = cdata->rate;
 
        /* Find the selected configuration with nearest sample rate */