ASoC: core: Don't set "(null)" as a driver name
authorJarkko Nikula <jhnikula@gmail.com>
Fri, 20 May 2011 12:47:40 +0000 (15:47 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 22 May 2011 02:31:11 +0000 (10:31 +0800)
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 the card->name if no driver name is specified.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-core.c

index 5968745213f8c5ee767613fa1b6c069e06380568..bb7cd58129459cbd9f0fb729ad61d4ed7070ee18 100644 (file)
@@ -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 : card->name);
 
        if (card->late_probe) {
                ret = card->late_probe(card);