[alsa-devel] [PATCH] ASoC: core: Don't set "(null)" as a driver name

Jarkko Nikula jhnikula at gmail.com
Fri May 20 14:21:26 CEST 2011


Commit 22de71b ("ASoC: core - allow ASoC more flexible machine name")
writes "(null)" to driver name string in struct snd_card if card->driver_name
is NULL. This causes segmentation faults with some user space ALSA utilities
like aplay and arecord.

Fix this by using null terminated string instead as this was the case before.

Signed-off-by: Jarkko Nikula <jhnikula at gmail.com>
---
 sound/soc/soc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5968745..ab05f42 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1930,7 +1930,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
 	snprintf(card->snd_card->longname, sizeof(card->snd_card->longname),
 		 "%s", card->long_name ? card->long_name : card->name);
 	snprintf(card->snd_card->driver, sizeof(card->snd_card->driver),
-		 "%s", card->driver_name);
+		 "%s", card->driver_name ? card->driver_name : "");
 
 	if (card->late_probe) {
 		ret = card->late_probe(card);
-- 
1.7.4.4



More information about the Alsa-devel mailing list