aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dsp.c
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2011-08-03 04:51:02 -0500
committerSimon Wilson <simonwilson@google.com>2011-08-03 15:41:45 -0700
commitf0b70172a5190c375e5bd425f60d3a795b75e689 (patch)
tree5fc9fd48b39148d6873a7782af1b0aa130f1bb56 /sound/soc/soc-dsp.c
parentfad3d223e2c62a6d5b706e81808c25f5c46e93d2 (diff)
downloadkernel_samsung_tuna-f0b70172a5190c375e5bd425f60d3a795b75e689.zip
kernel_samsung_tuna-f0b70172a5190c375e5bd425f60d3a795b75e689.tar.gz
kernel_samsung_tuna-f0b70172a5190c375e5bd425f60d3a795b75e689.tar.bz2
ASoC: dsp: Free widget_list only if paths found
When searching for new paths to add or prune, ASoC DSP queries the number of connected paths for a specific stream name and direction to DAPM. If paths are found, then the widget list is allocated by DAPM and returned to DSP. If no widgets are found, then widget list is not allocated. So, check if widget list was allocated before freeing it in ASoC DSP. Change-Id: Iaecdff5a0e6b7974d51c062bbcc881df0552c74f Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound/soc/soc-dsp.c')
-rw-r--r--sound/soc/soc-dsp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/soc/soc-dsp.c b/sound/soc/soc-dsp.c
index 0afd68b..f41d904 100644
--- a/sound/soc/soc-dsp.c
+++ b/sound/soc/soc-dsp.c
@@ -150,7 +150,7 @@ static int dsp_add_new_paths(struct snd_soc_pcm_runtime *fe,
{
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
struct snd_soc_card *card = fe->card;
- struct snd_soc_dapm_widget_list *list;
+ struct snd_soc_dapm_widget_list *list = NULL;
enum snd_soc_dapm_type fe_type, be_type;
int i, count = 0, err, paths;
@@ -203,7 +203,9 @@ static int dsp_add_new_paths(struct snd_soc_pcm_runtime *fe,
}
out:
- kfree(list);
+ /* list could be not initialized if root widget not found */
+ if (list != NULL)
+ kfree(list);
return count;
}
@@ -217,7 +219,7 @@ static int dsp_prune_old_paths(struct snd_soc_pcm_runtime *fe, int stream,
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
struct snd_soc_card *card = fe->card;
struct snd_soc_dsp_params *dsp_params;
- struct snd_soc_dapm_widget_list *list;
+ struct snd_soc_dapm_widget_list *list = NULL;
int count = 0, paths;
enum snd_soc_dapm_type fe_type, be_type;
struct snd_soc_dapm_widget *widget;
@@ -278,7 +280,9 @@ static int dsp_prune_old_paths(struct snd_soc_pcm_runtime *fe, int stream,
/* the number of old paths pruned */
out:
- kfree(list);
+ /* list could be not initialized if root widget not found */
+ if (list != NULL)
+ kfree(list);
return count;
}