Skip to content

Commit

Permalink
ASoC: SOF: sof-audio: Fix DSP core put imbalance on widget setup failure
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ujfalusi authored and plbossart committed Sep 7, 2023
1 parent da1489a commit 9ec8e50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/soc/sof/sof-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ static int sof_widget_setup_unlocked(struct snd_sof_dev *sdev,
sof_widget_free_unlocked(sdev, swidget);
use_count_decremented = true;
core_put:
snd_sof_dsp_core_put(sdev, swidget->core);
if (!use_count_decremented)
snd_sof_dsp_core_put(sdev, swidget->core);
pipe_widget_free:
if (swidget->id != snd_soc_dapm_scheduler)
sof_widget_free_unlocked(sdev, swidget->spipe->pipe_widget);
Expand Down

0 comments on commit 9ec8e50

Please sign in to comment.