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 <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230914124725.17397-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6ba59c0 commit bb0216d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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)