Commit c1619ea2 authored by Mark Brown's avatar Mark Brown

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.
parents fcc4348a cc755b43
...@@ -271,9 +271,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg ...@@ -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_sof_widget *swidget = widget->dobj.private;
struct snd_soc_dapm_path *p; struct snd_soc_dapm_path *p;
/* return if the widget is in use or if it is already unprepared */ /* skip if the widget is in use or if it is already unprepared */
if (!swidget->prepared || swidget->use_count > 1) if (!swidget || !swidget->prepared || swidget->use_count > 0)
return; goto sink_unprepare;
if (widget_ops[widget->id].ipc_unprepare) if (widget_ops[widget->id].ipc_unprepare)
/* unprepare the source widget */ /* unprepare the source widget */
...@@ -281,6 +281,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg ...@@ -281,6 +281,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
swidget->prepared = false; swidget->prepared = false;
sink_unprepare:
/* unprepare all widgets in the sink paths */ /* unprepare all widgets in the sink paths */
snd_soc_dapm_widget_for_each_sink_path(widget, p) { snd_soc_dapm_widget_for_each_sink_path(widget, p) {
if (!p->walking && p->sink->dobj.private) { 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 ...@@ -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; struct snd_soc_dapm_path *p;
int ret; int ret;
if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared)
goto sink_prepare; goto sink_prepare;
/* prepare the source widget */ /* prepare the source widget */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment