Commit 699f8584 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus

parents b9fb7299 e5092c96
...@@ -592,9 +592,9 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, ...@@ -592,9 +592,9 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
int shared; int shared;
struct snd_kcontrol *kcontrol; struct snd_kcontrol *kcontrol;
bool wname_in_long_name, kcname_in_long_name; bool wname_in_long_name, kcname_in_long_name;
char *long_name; char *long_name = NULL;
const char *name; const char *name;
int ret; int ret = 0;
prefix = soc_dapm_prefix(dapm); prefix = soc_dapm_prefix(dapm);
if (prefix) if (prefix)
...@@ -653,15 +653,17 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, ...@@ -653,15 +653,17 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name, kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], NULL, name,
prefix); prefix);
kfree(long_name); if (!kcontrol) {
if (!kcontrol) ret = -ENOMEM;
return -ENOMEM; goto exit_free;
}
kcontrol->private_free = dapm_kcontrol_free; kcontrol->private_free = dapm_kcontrol_free;
ret = dapm_kcontrol_data_alloc(w, kcontrol); ret = dapm_kcontrol_data_alloc(w, kcontrol);
if (ret) { if (ret) {
snd_ctl_free_one(kcontrol); snd_ctl_free_one(kcontrol);
return ret; goto exit_free;
} }
ret = snd_ctl_add(card, kcontrol); ret = snd_ctl_add(card, kcontrol);
...@@ -669,17 +671,18 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, ...@@ -669,17 +671,18 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
dev_err(dapm->dev, dev_err(dapm->dev,
"ASoC: failed to add widget %s dapm kcontrol %s: %d\n", "ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
w->name, name, ret); w->name, name, ret);
return ret; goto exit_free;
} }
} }
ret = dapm_kcontrol_add_widget(kcontrol, w); ret = dapm_kcontrol_add_widget(kcontrol, w);
if (ret) if (ret == 0)
return ret; w->kcontrols[kci] = kcontrol;
w->kcontrols[kci] = kcontrol; exit_free:
kfree(long_name);
return 0; return ret;
} }
/* create new dapm mixer control */ /* create new dapm mixer control */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment