2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 19:53:59 +08:00

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>
This commit is contained in:
Lars-Peter Clausen 2013-08-01 14:08:06 +02:00 committed by Mark Brown
parent 46a02c978f
commit 9356e9d51c

View File

@ -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) {