aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c11
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,
289 struct snd_soc_dapm_widget *w) 289 struct snd_soc_dapm_widget *w)
290{ 290{
291 int i, ret = 0; 291 int i, ret = 0;
292 char name[32]; 292 size_t name_len;
293 struct snd_soc_dapm_path *path; 293 struct snd_soc_dapm_path *path;
294 294
295 /* add kcontrol */ 295 /* add kcontrol */
@@ -303,11 +303,16 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
303 continue; 303 continue;
304 304
305 /* add dapm control with long name */ 305 /* add dapm control with long name */
306 snprintf(name, 32, "%s %s", w->name, w->kcontrols[i].name); 306 name_len = 2 + strlen(w->name)
307 path->long_name = kstrdup (name, GFP_KERNEL); 307 + strlen(w->kcontrols[i].name);
308 path->long_name = kmalloc(name_len, GFP_KERNEL);
308 if (path->long_name == NULL) 309 if (path->long_name == NULL)
309 return -ENOMEM; 310 return -ENOMEM;
310 311
312 snprintf(path->long_name, name_len, "%s %s",
313 w->name, w->kcontrols[i].name);
314 path->long_name[name_len - 1] = '\0';
315
311 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, 316 path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w,
312 path->long_name); 317 path->long_name);
313 ret = snd_ctl_add(codec->card, path->kcontrol); 318 ret = snd_ctl_add(codec->card, path->kcontrol);