diff options
author | Mark Brown <broonie@kernel.org> | 2023-01-18 15:28:17 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-01-18 15:28:17 +0000 |
commit | c1619ea22d9509cfbcf5c2c1cc65563179e9dc8e (patch) | |
tree | 7facaee4ce05cd4d60a983c835447de00db9a9b1 /sound | |
parent | fcc4348adafe53928fda46d104c1798e5a4de4ff (diff) | |
parent | cc755b4377b0520d594ae573497cf0824baea648 (diff) |
ASoC: SOF: sof-audio: Fixes for widget prepare and
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
This series contains one fix (first patch) followed by a nice to have safety
belts in case we get a widget from topology which is not handled by SOF and will
not have corresponding swidget associated with.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/sof/sof-audio.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 41e4dd447b92..275b1ae45306 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -271,9 +271,9 @@ 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; - /* return if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 1) - return; + /* skip if the widget is in use or if it is already unprepared */ + if (!swidget || !swidget->prepared || swidget->use_count > 0) + goto sink_unprepare; if (widget_ops[widget->id].ipc_unprepare) /* unprepare the source widget */ @@ -281,6 +281,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg 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) { @@ -303,7 +304,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget struct snd_soc_dapm_path *p; int ret; - if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) + if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) goto sink_prepare; /* prepare the source widget */ |