ASoC: Fix memory allocation for snd_soc_dapm_switch names

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:09 pm

Gitweb:     http://git.kernel.org/linus/07495f3e5af3a472f0f49957692cac15168fa528
Commit:     07495f3e5af3a472f0f49957692cac15168fa528
Parent:     b0c5033f02182d1e9634edc737df88b82264e820
Author:     Mark Brown <broonie@opensource.wolfsonmicro.com>
AuthorDate: Thu Mar 5 17:06:23 2009 +0000
Committer:  Mark Brown <broonie@opensource.wolfsonmicro.com>
CommitDate: Fri Mar 6 13:37:14 2009 +0000

    ASoC: Fix memory allocation for snd_soc_dapm_switch names
    
    snd_soc_dapm_switch ends up ends up in dapm_new_mixer() (since a switch
    is a special case of a mixer with only one input) but this wasn't
    correctly handled in the code.
    
    Also fix the coding style for the switch below while we're here.
    
    Reported-by: Joonyoung Shim <dofmind@gmail.com>
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7da6d0d..735903a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -332,7 +332,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
 			 * kcontrol name.
 			 */
 			name_len = strlen(w->kcontrols[i].name) + 1;
-			if (w->id == snd_soc_dapm_mixer)
+			if (w->id != snd_soc_dapm_mixer_named_ctl)
 				name_len += 1 + strlen(w->name);
 
 			path->long_name = kmalloc(name_len, GFP_KERNEL);
@@ -341,15 +341,14 @@ static int dapm_new_mixer(struct snd_soc_codec *codec,
 				return -ENOMEM;
 
 			switch (w->id) {
-			case snd_soc_dapm_mixer:
 			default:
 				snprintf(path->long_name, name_len, "%s %s",
 					 w->name, w->kcontrols[i].name);
-			break;
+				break;
 			case snd_soc_dapm_mixer_named_ctl:
 				snprintf(path->long_name, name_len, "%s",
 					 w->kcontrols[i].name);
-			break;
+				break;
 			}
 
 			path->long_name[name_len - 1] = '\0';
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ASoC: Fix memory allocation for snd_soc_dapm_switch names, Linux Kernel Mailing ..., (Thu Mar 26, 12:09 pm)