Takashi Iwai | 5 Jul 08:33 2011
Picon

Re: ALSA become "Segmentation fault" on current linus tree

At Tue, 05 Jul 2011 15:29:39 +0900,
kuninori.morimoto.gx <at> renesas.com wrote:
> 
> 
> Dear Takashi
> 
> > So, driver name setup seems screwing up.
> > What shows /proc/asound/cards?  It contains also the driver string.
> 
> Current /proc/asound/cards is
> 
> ----------------------------------
> # cat /proc/asound/cards
>  0 [AK4643         ]: FSI2A (AK4643) - FSI2A (AK4643)
>                       FSI2A (AK4643)
>  1 [HDMI           ]: FSI2B (SH MOBIL - FSI2B (SH MOBILE HDMI)
>                       FSI2B (SH MOBILE HDMI)
> ----------------------------------
> 
> Ohh my...
> If I modified like this, it start works
> 
> ----------------------------------
> # cat /proc/asound/cards                                                        
>  0 [FSI2A          ]: FSI2A - FSI2A                                             
>                       FSI2A                                                     
>  1 [FSI2B          ]: FSI2B - FSI2B                                             
>                       FSI2B             
> ----------------------------------
> 
> Should it be short name ?

For the compatible behavior, we can keep it empty like the patch
below.  It wasn't set in the earlier versions.

Alternatively, driver name can be deduced from shortname by replacing
invalid characters.  In general, it shouldn't contain space letters and
special letters like parentheses.

But, driver_name should override if defined, and ASoC stuff has worked
well without driver name setup, we can keep it empty as default, I guess.

thanks,

Takashi

---
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d08abf4..954e3b7 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
 <at>  <at>  -1420,8 +1420,9  <at>  <at>  static void snd_soc_instantiate_card(struct snd_soc_card *card)
 		 "%s", card->name);
 	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 ? card->driver_name : card->name);
+	if (card->driver_name)
+		snprintf(card->snd_card->driver, sizeof(card->snd_card->driver),
+			 "%s", card->driver_name);

 	if (card->late_probe) {
 		ret = card->late_probe(card);

Gmane