All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: Don't set "(null)" as a driver name
@ 2011-05-20 12:21 Jarkko Nikula
  2011-05-20 12:32 ` Liam Girdwood
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Nikula @ 2011-05-20 12:21 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

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@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: core: Don't set "(null)" as a driver name
  2011-05-20 12:21 [PATCH] ASoC: core: Don't set "(null)" as a driver name Jarkko Nikula
@ 2011-05-20 12:32 ` Liam Girdwood
  2011-05-20 12:40   ` Jarkko Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Liam Girdwood @ 2011-05-20 12:32 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel@alsa-project.org, Mark Brown

On 20/05/11 13:21, Jarkko Nikula wrote:
> 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@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);


This looks good but we may want to make the default driver name (if no driver name is specified) to be the card->name instead of " " and should return an error if card->name is NULL.

Liam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: core: Don't set "(null)" as a driver name
  2011-05-20 12:32 ` Liam Girdwood
@ 2011-05-20 12:40   ` Jarkko Nikula
  0 siblings, 0 replies; 3+ messages in thread
From: Jarkko Nikula @ 2011-05-20 12:40 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel@alsa-project.org, Mark Brown

On Fri, 20 May 2011 13:32:31 +0100
Liam Girdwood <lrg@ti.com> wrote:

> This looks good but we may want to make the default driver name (if no driver name is specified) to be the card->name instead of " " and should return an error if card->name is NULL.
> 
Sounds better and card->name is already tested in
snd_soc_register_card. I'll update the patch.

-- 
Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-20 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-20 12:21 [PATCH] ASoC: core: Don't set "(null)" as a driver name Jarkko Nikula
2011-05-20 12:32 ` Liam Girdwood
2011-05-20 12:40   ` Jarkko Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.