Skip to content

Commit bb0216d

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: sof-audio: Fix DSP core put imbalance on widget setup failure
In case the widget setup fails we should only decrement the core usage count if the sof_widget_free_unlocked() has not been called as part of the error handling. sof_widget_free_unlocked() calls snd_sof_dsp_core_put() and the additional core_put will cause imbalance in core usage count. Use the existing use_count_decremented to handle this issue. Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6ba59c0 commit bb0216d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/sof/sof-audio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ static int sof_widget_setup_unlocked(struct snd_sof_dev *sdev,
212212
sof_widget_free_unlocked(sdev, swidget);
213213
use_count_decremented = true;
214214
core_put:
215-
snd_sof_dsp_core_put(sdev, swidget->core);
215+
if (!use_count_decremented)
216+
snd_sof_dsp_core_put(sdev, swidget->core);
216217
pipe_widget_free:
217218
if (swidget->id != snd_soc_dapm_scheduler)
218219
sof_widget_free_unlocked(sdev, swidget->spipe->pipe_widget);

0 commit comments

Comments
 (0)