[alsa-devel] [PATCH][ASoC V2] Fix null-pointer dereference in soc_create_pcm()

Timur Tabi timur at freescale.com
Tue May 20 00:45:59 CEST 2008

When soc_create_pcm() finds all four components it needs, it displays a status
message.  This message references the local variables 'codec_dai' and
'cpu_dai', but these variables are initialized only when the codec DAI and the
cpu DAI are the last to be registered.  This patch changes the code to use the
stored values instead of the local variables.

Signed-off-by: Timur Tabi <timur at freescale.com>
 sound/soc/soc-core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7dc6d68..520469b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -921,8 +921,8 @@ check:
 	pcm->private_free = platform->pcm_free;
-	printk(KERN_INFO "asoc: %s <-> %s mapping ok\n", codec_dai->name,
-		cpu_dai->name);
+	printk(KERN_INFO "asoc: %s <-> %s mapping ok\n",
+		pcm_runtime->codec_dai->name, pcm_runtime->cpu_dai->name);
 	list_add(&pcm_runtime->list, &soc_card->pcm_list);
 	return 1;

More information about the Alsa-devel mailing list