diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-08-01 08:08:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-01 09:12:59 -0400 |
commit | 9356e9d51c80114fce2d7d8be99bce1d7e19d063 (patch) | |
tree | b510ee65c095dd5ceecc218023d9270a5f7a9f7d /sound | |
parent | 46a02c978fbc79de856d0fe7a8c1d4fc620796e0 (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')
-rw-r--r-- | sound/soc/soc-dapm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d74c3560d556..b4fae8717851 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, | |||
671 | 671 | ||
672 | kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, | 672 | kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, |
673 | prefix); | 673 | prefix); |
674 | kcontrol->private_free = dapm_kcontrol_free; | ||
675 | kfree(long_name); | 674 | kfree(long_name); |
675 | if (!kcontrol) | ||
676 | return -ENOMEM; | ||
677 | kcontrol->private_free = dapm_kcontrol_free; | ||
676 | 678 | ||
677 | ret = dapm_kcontrol_data_alloc(w, kcontrol); | 679 | ret = dapm_kcontrol_data_alloc(w, kcontrol); |
678 | if (ret) { | 680 | if (ret) { |