diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-10-28 16:02:31 +0300 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-10-30 17:34:03 +0300 |
commit | 219b93f5252086c8c8d647c77fc9e1377aab0c8d (patch) | |
tree | 844eb83f3ca3983164357f063b777f60b7c580a1 /sound/soc/soc-dapm.c | |
parent | f24368c2fb524e911b831b86b5f0acfb38c70317 (diff) | |
download | linux-219b93f5252086c8c8d647c77fc9e1377aab0c8d.tar.xz |
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: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index b51d82285be4..407092c226f9 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -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 */ @@ -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); |