summaryrefslogtreecommitdiffstats
path: root/ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch')
-rw-r--r--ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch b/ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch
new file mode 100644
index 000000000..f86069ab9
--- /dev/null
+++ b/ASoC-topology-fix-soc_tplg_fe_link_create-link-dobj-.patch
@@ -0,0 +1,60 @@
+From 29bc8978342b2d94a65801904c44dc7b0ef88da2 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Wed, 22 Jan 2020 20:07:52 +0100
+Subject: [PATCH] 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 76d270364932 was applied.
+
+Fixes: 76d270364932 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
+Cc: Dragos Tarcatu <dragos_tarcatu@mentor.com>
+Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+---
+ sound/soc/soc-topology.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
+index fd2d22ddc81b..1c143a00633f 100644
+--- a/sound/soc/soc-topology.c
++++ b/sound/soc/soc-topology.c
+@@ -1891,6 +1891,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
+ link->num_codecs = 1;
+ link->num_platforms = 1;
+
++ link->dobj.index = tplg->index;
++ link->dobj.ops = tplg->ops;
++ link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
++
+ if (strlen(pcm->pcm_name)) {
+ link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
+ link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
+@@ -1927,9 +1931,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
+ goto err;
+ }
+
+- link->dobj.index = tplg->index;
+- link->dobj.ops = tplg->ops;
+- link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
+ list_add(&link->dobj.list, &tplg->comp->dobj_list);
+
+ return 0;
+--
+2.24.1
+