All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init()
@ 2011-02-02 20:11 Janusz Krzysztofik
  2011-02-02 20:48 ` Liam Girdwood
  2011-02-03  6:47 ` Jarkko Nikula
  0 siblings, 2 replies; 3+ messages in thread
From: Janusz Krzysztofik @ 2011-02-02 20:11 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

The .card member of the snd_soc_pcm_runtime structure pointed to by the 
snd_soc_dai_link.init() argument used to be initialized before the 
function being called. This has changed, probably unintentionally, 
after recent refactorings. Since the function implementations are free 
to make use of this pointer, move its assignment back before the 
function is called to avoid NULL pointer dereferences.

Created and tested on Amstrad Delta againts linux-2.6.38-rc2

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
Jarkko,
I'm not sure if this change won't break anything in your dailess related 
code path, please verify.

Thanks,
Janusz

 sound/soc/soc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- git/sound/soc/soc-core.c.orig	2011-01-31 19:49:29.000000000 +0100
+++ git/sound/soc/soc-core.c	2011-02-02 20:23:10.000000000 +0100
@@ -1449,6 +1449,7 @@ static int soc_post_component_init(struc
 		rtd = &card->rtd_aux[num];
 		name = aux_dev->name;
 	}
+	rtd->card = card;
 
 	/* machine controls, routes and widgets are not prefixed */
 	temp = codec->name_prefix;
@@ -1471,7 +1472,6 @@ static int soc_post_component_init(struc
 
 	/* register the rtd device */
 	rtd->codec = codec;
-	rtd->card = card;
 	rtd->dev.parent = card->dev;
 	rtd->dev.release = rtd_release;
 	rtd->dev.init_name = name;

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

* Re: [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init()
  2011-02-02 20:11 [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init() Janusz Krzysztofik
@ 2011-02-02 20:48 ` Liam Girdwood
  2011-02-03  6:47 ` Jarkko Nikula
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-02-02 20:48 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: alsa-devel, Mark Brown

On Wed, 2011-02-02 at 21:11 +0100, Janusz Krzysztofik wrote:
> The .card member of the snd_soc_pcm_runtime structure pointed to by the 
> snd_soc_dai_link.init() argument used to be initialized before the 
> function being called. This has changed, probably unintentionally, 
> after recent refactorings. Since the function implementations are free 
> to make use of this pointer, move its assignment back before the 
> function is called to avoid NULL pointer dereferences.
> 
> Created and tested on Amstrad Delta againts linux-2.6.38-rc2
> 
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

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

* Re: [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init()
  2011-02-02 20:11 [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init() Janusz Krzysztofik
  2011-02-02 20:48 ` Liam Girdwood
@ 2011-02-03  6:47 ` Jarkko Nikula
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Nikula @ 2011-02-03  6:47 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: alsa-devel, Mark Brown, Liam Girdwood

On Wed, 2 Feb 2011 21:11:41 +0100
Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> wrote:

> The .card member of the snd_soc_pcm_runtime structure pointed to by the 
> snd_soc_dai_link.init() argument used to be initialized before the 
> function being called. This has changed, probably unintentionally, 
> after recent refactorings. Since the function implementations are free 
> to make use of this pointer, move its assignment back before the 
> function is called to avoid NULL pointer dereferences.
> 
> Created and tested on Amstrad Delta againts linux-2.6.38-rc2
> 
> Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> ---
> Jarkko,
> I'm not sure if this change won't break anything in your dailess related 
> code path, please verify.
> 
> Thanks,
> Janusz
> 
>  sound/soc/soc-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- git/sound/soc/soc-core.c.orig	2011-01-31 19:49:29.000000000 +0100
> +++ git/sound/soc/soc-core.c	2011-02-02 20:23:10.000000000 +0100
> @@ -1449,6 +1449,7 @@ static int soc_post_component_init(struc
>  		rtd = &card->rtd_aux[num];
>  		name = aux_dev->name;
>  	}
> +	rtd->card = card;
>  
>  	/* machine controls, routes and widgets are not prefixed */
>  	temp = codec->name_prefix;
> @@ -1471,7 +1472,6 @@ static int soc_post_component_init(struc
>  
>  	/* register the rtd device */
>  	rtd->codec = codec;
> -	rtd->card = card;
>  	rtd->dev.parent = card->dev;
>  	rtd->dev.release = rtd_release;
>  	rtd->dev.init_name = name;

Thanks for spotting this Janusz. This was unintentional change done by
the commit 589c356. Yet another proof how important platform is the
Amstrad Delta :-)

rtd->codec is ok since it is set in soc_bind_dai_link prior calling the
snd_soc_dai_link.init and snd_soc_aux_dev.init doesn't need it. Would
be nice to set other rtd fields also where the rtd->card is set but
that's not as urgent change than this.

Acked-by: Jarkko Nikula <jhnikula@gmail.com>

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

end of thread, other threads:[~2011-02-03  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-02 20:11 [PATCH 2.6.38] ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init() Janusz Krzysztofik
2011-02-02 20:48 ` Liam Girdwood
2011-02-03  6:47 ` 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.