summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2024-06-12 15:12:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-25 09:49:15 +0200
commita45309a37a09546993216a304f40315e74bbfb26 (patch)
tree5dfefa0ebe7c84776f02978835528209da69f777
parent5bd418c968ce718b38713c459639a5197285b11b (diff)
downloadlinux-a45309a37a09546993216a304f40315e74bbfb26.tar.gz
linux-a45309a37a09546993216a304f40315e74bbfb26.tar.bz2
linux-a45309a37a09546993216a304f40315e74bbfb26.zip
ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback
[ Upstream commit 6f2a43e3d14f6e31a3b041a1043195d02c54d615 ] If the ipc_prepare() callback fails for a module instance, on error rewind we must skip the ipc_unprepare() call for ones that has positive use count. The positive use count means that the module instance is in active use, it cannot be unprepared. The issue affects capture direction paths with branches (single dai with multiple PCMs), the affected widgets are in the shared part of the paths. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20240612121203.15468-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--sound/soc/sof/sof-audio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index 061ab7289a6c..b1141f447816 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -328,7 +328,7 @@ sink_prepare:
if (ret < 0) {
/* unprepare the source widget */
if (widget_ops[widget->id].ipc_unprepare &&
- swidget && swidget->prepared) {
+ swidget && swidget->prepared && swidget->use_count == 0) {
widget_ops[widget->id].ipc_unprepare(swidget);
swidget->prepared = false;
}