|
@@ -521,7 +521,6 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
|
|
|
int wlistentries;
|
|
|
size_t wlistsize;
|
|
|
bool wname_in_long_name, kcname_in_long_name;
|
|
|
- size_t name_len;
|
|
|
char *long_name;
|
|
|
const char *name;
|
|
|
int ret;
|
|
@@ -586,25 +585,19 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
|
|
|
}
|
|
|
|
|
|
if (wname_in_long_name && kcname_in_long_name) {
|
|
|
- name_len = strlen(w->name) - prefix_len + 1 +
|
|
|
- strlen(w->kcontrol_news[kci].name) + 1;
|
|
|
-
|
|
|
- long_name = kmalloc(name_len, GFP_KERNEL);
|
|
|
- if (long_name == NULL) {
|
|
|
- kfree(wlist);
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
-
|
|
|
/*
|
|
|
* The control will get a prefix from the control
|
|
|
* creation process but we're also using the same
|
|
|
* prefix for widgets so cut the prefix off the
|
|
|
* front of the widget name.
|
|
|
*/
|
|
|
- snprintf(long_name, name_len, "%s %s",
|
|
|
+ long_name = kasprintf(GFP_KERNEL, "%s %s",
|
|
|
w->name + prefix_len,
|
|
|
w->kcontrol_news[kci].name);
|
|
|
- long_name[name_len - 1] = '\0';
|
|
|
+ if (long_name == NULL) {
|
|
|
+ kfree(wlist);
|
|
|
+ return -ENOMEM;
|
|
|
+ }
|
|
|
|
|
|
name = long_name;
|
|
|
} else if (wname_in_long_name) {
|
|
@@ -3077,7 +3070,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
|
|
|
const struct snd_soc_dapm_widget *widget)
|
|
|
{
|
|
|
struct snd_soc_dapm_widget *w;
|
|
|
- size_t name_len;
|
|
|
int ret;
|
|
|
|
|
|
if ((w = dapm_cnew_widget(widget)) == NULL)
|
|
@@ -3118,19 +3110,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- name_len = strlen(widget->name) + 1;
|
|
|
if (dapm->codec && dapm->codec->name_prefix)
|
|
|
- name_len += 1 + strlen(dapm->codec->name_prefix);
|
|
|
- w->name = kmalloc(name_len, GFP_KERNEL);
|
|
|
+ w->name = kasprintf(GFP_KERNEL, "%s %s",
|
|
|
+ dapm->codec->name_prefix, widget->name);
|
|
|
+ else
|
|
|
+ w->name = kasprintf(GFP_KERNEL, "%s", widget->name);
|
|
|
+
|
|
|
if (w->name == NULL) {
|
|
|
kfree(w);
|
|
|
return NULL;
|
|
|
}
|
|
|
- if (dapm->codec && dapm->codec->name_prefix)
|
|
|
- snprintf((char *)w->name, name_len, "%s %s",
|
|
|
- dapm->codec->name_prefix, widget->name);
|
|
|
- else
|
|
|
- snprintf((char *)w->name, name_len, "%s", widget->name);
|
|
|
|
|
|
switch (w->id) {
|
|
|
case snd_soc_dapm_switch:
|