aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/sof/sof-audio.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index a3d3dd7a0037..62092e2d609c 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -271,14 +271,16 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
struct snd_sof_widget *swidget = widget->dobj.private;
struct snd_soc_dapm_path *p;
- if (!widget_ops[widget->id].ipc_unprepare || !swidget->prepared)
- goto sink_unprepare;
+ /* return if the widget is in use or if it is already unprepared */
+ if (!swidget->prepared || swidget->use_count > 1)
+ return;
+
+ if (widget_ops[widget->id].ipc_unprepare)
+ /* unprepare the source widget */
+ widget_ops[widget->id].ipc_unprepare(swidget);
- /* unprepare the source widget */
- widget_ops[widget->id].ipc_unprepare(swidget);
swidget->prepared = false;
-sink_unprepare:
/* unprepare all widgets in the sink paths */
snd_soc_dapm_widget_for_each_sink_path(widget, p) {
if (!p->walking && p->sink->dobj.private) {