Unverified Commit c1619ea2 authored by Mark Brown's avatar Mark Brown
Browse files

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
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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 */