aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-02 13:18:24 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-03 06:15:03 -0500
commit88e8b9a84b41be8ea37cf3bbe192e72f84747f66 (patch)
tree5a86710db573932a0308c3aefa900b6233362c64 /sound/soc/soc-dapm.c
parent12ea2c782e8bd98bcbf88165b2fd1610d1b9a81d (diff)
ASoC: Check for a CODEC before dereferencing in DAPM
A CODEC pointer is optional (and is checked for in most contexts within DAPM) - add checks to the few places where it was missed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8240ab853d78..570db8819d9b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1517,7 +1517,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
1517 char prefixed_source[80]; 1517 char prefixed_source[80];
1518 int ret = 0; 1518 int ret = 0;
1519 1519
1520 if (dapm->codec->name_prefix) { 1520 if (dapm->codec && dapm->codec->name_prefix) {
1521 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s", 1521 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s",
1522 dapm->codec->name_prefix, route->sink); 1522 dapm->codec->name_prefix, route->sink);
1523 sink = prefixed_sink; 1523 sink = prefixed_sink;
@@ -2167,14 +2167,14 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
2167 return -ENOMEM; 2167 return -ENOMEM;
2168 2168
2169 name_len = strlen(widget->name) + 1; 2169 name_len = strlen(widget->name) + 1;
2170 if (dapm->codec->name_prefix) 2170 if (dapm->codec && dapm->codec->name_prefix)
2171 name_len += 1 + strlen(dapm->codec->name_prefix); 2171 name_len += 1 + strlen(dapm->codec->name_prefix);
2172 w->name = kmalloc(name_len, GFP_KERNEL); 2172 w->name = kmalloc(name_len, GFP_KERNEL);
2173 if (w->name == NULL) { 2173 if (w->name == NULL) {
2174 kfree(w); 2174 kfree(w);
2175 return -ENOMEM; 2175 return -ENOMEM;
2176 } 2176 }
2177 if (dapm->codec->name_prefix) 2177 if (dapm->codec && dapm->codec->name_prefix)
2178 snprintf(w->name, name_len, "%s %s", 2178 snprintf(w->name, name_len, "%s %s",
2179 dapm->codec->name_prefix, widget->name); 2179 dapm->codec->name_prefix, widget->name);
2180 else 2180 else