summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9d95ef531308..4489c5b7b53a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2237,7 +2237,6 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
struct snd_kcontrol_new template;
struct snd_kcontrol *kcontrol;
char *name = NULL;
- int name_len;
memcpy(&template, _template, sizeof(template));
template.index = 0;
@@ -2246,13 +2245,10 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
long_name = template.name;
if (prefix) {
- name_len = strlen(long_name) + strlen(prefix) + 2;
- name = kmalloc(name_len, GFP_KERNEL);
+ name = kasprintf(GFP_KERNEL, "%s %s", prefix, long_name);
if (!name)
return NULL;
- snprintf(name, name_len, "%s %s", prefix, long_name);
-
template.name = name;
} else {
template.name = long_name;