Skip to content

Commit

Permalink
ASoC: dapm: Check return value of snd_soc_cnew()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Aug 1, 2013
1 parent 46a02c9 commit 9356e9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9356e9d

Please sign in to comment.