[alsa-devel] [PATCH v2 04/14] ASoC: soc-core: create rtd->codec_dais first
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Thu Sep 12 06:39:32 CEST 2019
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
soc_new_pcm_runtime() allocs rtd and rtd->codec_dais.
This patch allocs both first, and setup these after that.
This is prepare for soc_new_pcm_runtime() cleanup.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v1 -> v2
- new patch
- [05/14] will be more readable
sound/soc/soc-core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 44e1bff..fe6cafd 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -372,12 +372,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
if (!rtd)
return NULL;
- INIT_LIST_HEAD(&rtd->component_list);
- rtd->card = card;
- rtd->dai_link = dai_link;
- if (!rtd->dai_link->ops)
- rtd->dai_link->ops = &null_snd_soc_ops;
-
rtd->codec_dais = kcalloc(dai_link->num_codecs,
sizeof(struct snd_soc_dai *),
GFP_KERNEL);
@@ -386,6 +380,12 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
return NULL;
}
+ INIT_LIST_HEAD(&rtd->component_list);
+ rtd->card = card;
+ rtd->dai_link = dai_link;
+ if (!rtd->dai_link->ops)
+ rtd->dai_link->ops = &null_snd_soc_ops;
+
/* see for_each_card_rtds */
list_add_tail(&rtd->list, &card->rtd_list);
rtd->num = card->num_rtd;
--
2.7.4
More information about the Alsa-devel
mailing list