Skip to content

Commit 8ce1cbd

Browse files
perexgbroonie
authored andcommitted
ASoC: topology: fix soc_tplg_fe_link_create() - link->dobj initialization order
The code which checks the return value for snd_soc_add_dai_link() call in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before link->dobj members initialization. While it does not affect the latest kernels, the old soc-core.c code in the stable kernels is affected. The snd_soc_add_dai_link() function uses the link->dobj.type member to check, if the link structure is valid. Reorder the link->dobj initialization to make things work again. It's harmless for the recent code (and the structure should be properly initialized before other calls anyway). The problem is in stable linux-5.4.y since version 5.4.11 when the upstream commit 76d2703 was applied. Fixes: 76d2703 ("ASoC: topology: Check return value for snd_soc_add_dai_link()") Cc: Dragos Tarcatu <[email protected]> Cc: Pierre-Louis Bossart <[email protected]> Cc: Ranjani Sridharan <[email protected]> Cc: Mark Brown <[email protected]> Cc: <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 15adb20 commit 8ce1cbd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/soc-topology.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
19061906
link->num_codecs = 1;
19071907
link->num_platforms = 1;
19081908

1909+
link->dobj.index = tplg->index;
1910+
link->dobj.ops = tplg->ops;
1911+
link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
1912+
19091913
if (strlen(pcm->pcm_name)) {
19101914
link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
19111915
link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
@@ -1942,9 +1946,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
19421946
goto err;
19431947
}
19441948

1945-
link->dobj.index = tplg->index;
1946-
link->dobj.ops = tplg->ops;
1947-
link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
19481949
list_add(&link->dobj.list, &tplg->comp->dobj_list);
19491950

19501951
return 0;

0 commit comments

Comments
 (0)