Skip to content

Commit 7aea88b

Browse files
committed
ASoC: SOF: sof-audio: Fix error path in sof_widget_setup_unlocked()
If either tplg_ops->dai_config or widget_kcontrol_setup fail during widget setup we would double decrement the use_count of the widget because the sof_widget_free_unlocked() would be called twice, similarly the core_put would be invoked twice as well. The code between pipe_widget_free and use_count_dec is done within sof_widget_free_unlocked() and we need to skip it during error handling. The fixes tag is picked to the last change around this part of the code which is adequately old enough for backporting purposes. Link: thesofproject/sof#10826 Fixes: 31ed8da ("ASoC: SOF: sof-audio: Modify logic for enabling/disabling topology cores") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 3a0f2ae commit 7aea88b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sound/soc/sof/sof-audio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ static int sof_widget_setup_unlocked(struct snd_sof_dev *sdev,
228228
/* widget use_count will be decremented by sof_widget_free() */
229229
sof_widget_free_unlocked(sdev, swidget);
230230
use_count_decremented = true;
231+
/* sof_widget_free_unlocked already cleaned up pipe_widget/cores */
232+
goto use_count_dec;
231233
pipe_widget_free:
232234
if (swidget->id != snd_soc_dapm_scheduler) {
233235
sof_widget_free_unlocked(sdev, swidget->spipe->pipe_widget);

0 commit comments

Comments
 (0)