From: Lars-Peter Clausen Date: Thu, 1 Aug 2013 12:08:06 +0000 (+0200) Subject: ASoC: dapm: Check return value of snd_soc_cnew() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9356e9d51c80114fce2d7d8be99bce1d7e19d063;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Mark Brown --- 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, 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) {