Commit 219b93f5 authored by Mark Brown's avatar Mark Brown

ASoC: Remove DAPM restriction on mixer control name lengths

As well as ensuring that UI-relevant parts of control names don't get
truncated in the DAPM code this avoids conflicts in long control names
that differ only at the end of a long string.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent f24368c2
...@@ -289,7 +289,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec, ...@@ -289,7 +289,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
struct snd_soc_dapm_widget *w) struct snd_soc_dapm_widget *w)
{ {
int i, ret = 0; int i, ret = 0;
char name[32]; size_t name_len;
struct snd_soc_dapm_path *path; struct snd_soc_dapm_path *path;
/* add kcontrol */ /* add kcontrol */
...@@ -303,11 +303,16 @@ static int dapm_new_mixer(struct snd_soc_codec *codec, ...@@ -303,11 +303,16 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
continue; continue;
/* add dapm control with long name */ /* add dapm control with long name */
snprintf(name, 32, "%s %s", w->name, w->kcontrols[i].name); name_len = 2 + strlen(w->name)
path->long_name = kstrdup (name, GFP_KERNEL); + strlen(w->kcontrols[i].name);
path->long_name = kmalloc(name_len, GFP_KERNEL);
if (path->long_name == NULL) if (path->long_name == NULL)
return -ENOMEM; return -ENOMEM;
snprintf(path->long_name, name_len, "%s %s",
w->name, w->kcontrols[i].name);
path->long_name[name_len - 1] = '\0';
path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w,
path->long_name); path->long_name);
ret = snd_ctl_add(codec->card, path->kcontrol); ret = snd_ctl_add(codec->card, path->kcontrol);
......
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