ASoC: SOF: sof-audio: Fix DSP core put imbalance on widget setup failure
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 14 Sep 2023 12:47:25 +0000 (15:47 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 14 Sep 2023 14:32:43 +0000 (15:32 +0100)
commitbb0216d4db9ecaa51af45d8504757becbe5c050d
treea4c7ef8ee62158821c60f1f9d416804168c9685a
parent6ba59c008f08e84b3c87be10f3391c9735e4f833
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>
sound/soc/sof/sof-audio.c