]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: SOF: topology: No need to assign core ID if token parsing failed
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Mon, 7 Nov 2022 09:04:33 +0000 (11:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Nov 2022 08:27:52 +0000 (09:27 +0100)
[ Upstream commit 3d59eaef49ca2db581156a7b77c9afc0546eefc0 ]

Move the return value check before attempting to assign the core ID to the
swidget since we are going to fail the sof_widget_ready() and free up
swidget anyways.

Fixes: 909dadf21aae ("ASoC: SOF: topology: Make DAI widget parsing IPC agnostic")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221107090433.5146-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/sof/topology.c

index 9273a70fec25c5bf439b8fd43b67ed92c92fc6e9..e1b7f07de7fcd74d0e5ef15678e850fdcb22d42b 100644 (file)
@@ -1346,16 +1346,6 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
                break;
        }
 
-       if (sof_debug_check_flag(SOF_DBG_DISABLE_MULTICORE)) {
-               swidget->core = SOF_DSP_PRIMARY_CORE;
-       } else {
-               int core = sof_get_token_value(SOF_TKN_COMP_CORE_ID, swidget->tuples,
-                                              swidget->num_tuples);
-
-               if (core >= 0)
-                       swidget->core = core;
-       }
-
        /* check token parsing reply */
        if (ret < 0) {
                dev_err(scomp->dev,
@@ -1367,6 +1357,16 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
                return ret;
        }
 
+       if (sof_debug_check_flag(SOF_DBG_DISABLE_MULTICORE)) {
+               swidget->core = SOF_DSP_PRIMARY_CORE;
+       } else {
+               int core = sof_get_token_value(SOF_TKN_COMP_CORE_ID, swidget->tuples,
+                                              swidget->num_tuples);
+
+               if (core >= 0)
+                       swidget->core = core;
+       }
+
        /* bind widget to external event */
        if (tw->event_type) {
                if (widget_ops[w->id].bind_event) {