Skip to content

Commit

Permalink
ASoC: Remove DAPM restriction on mixer control name lengths
Browse files Browse the repository at this point in the history
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: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Oct 30, 2008
1 parent f24368c commit 219b93f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
struct snd_soc_dapm_widget *w)
{
int i, ret = 0;
char name[32];
size_t name_len;
struct snd_soc_dapm_path *path;

/* add kcontrol */
Expand All @@ -303,11 +303,16 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
continue;

/* add dapm control with long name */
snprintf(name, 32, "%s %s", w->name, w->kcontrols[i].name);
path->long_name = kstrdup (name, GFP_KERNEL);
name_len = 2 + strlen(w->name)
+ strlen(w->kcontrols[i].name);
path->long_name = kmalloc(name_len, GFP_KERNEL);
if (path->long_name == NULL)
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->long_name);
ret = snd_ctl_add(codec->card, path->kcontrol);
Expand Down

0 comments on commit 219b93f

Please sign in to comment.