From: Janusz Krzysztofik Date: Wed, 2 Feb 2011 20:11:41 +0000 (+0100) Subject: ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init() X-Git-Tag: Ubuntu-5.13.0-19.19~28586^2~10 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=0962bb217ac74c4b8fae34c5367ebc63131c962c;p=mirror_ubuntu-jammy-kernel.git ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init() 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c4b60610beb0..c3f6f1e72790 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1449,6 +1449,7 @@ static int soc_post_component_init(struct snd_soc_card *card, 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(struct snd_soc_card *card, /* 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;