aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-08-01 14:08:06 +0200
committerMark Brown <broonie@linaro.org>2013-08-01 14:12:59 +0100
commit9356e9d51c80114fce2d7d8be99bce1d7e19d063 (patch)
treeb510ee65c095dd5ceecc218023d9270a5f7a9f7d /sound/soc/soc-dapm.c
parent46a02c978fbc79de856d0fe7a8c1d4fc620796e0 (diff)
ASoC: dapm: Check return value of snd_soc_cnew()
snd_soc_cnew() can return NULL, so we should check the result before trying to use it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d74c3560d55..b4fae871785 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -671,8 +671,10 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name,
prefix);
- kcontrol->private_free = dapm_kcontrol_free;
kfree(long_name);
+ if (!kcontrol)
+ return -ENOMEM;
+ kcontrol->private_free = dapm_kcontrol_free;
ret = dapm_kcontrol_data_alloc(w, kcontrol);
if (ret) {