ASoC: SOF: Fix potential NULL pointer dereference
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Thu, 2 Jun 2022 13:57:57 +0000 (15:57 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 6 Jun 2022 11:31:21 +0000 (12:31 +0100)
Cleanup path for sof_prepare_widgets_in_path() should check if unprepare
callback exists before calling it, instead it checks if it does not
exist. Fix the check.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220602135757.3335351-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-audio.c

index 8d74063..2897609 100644 (file)
@@ -318,7 +318,7 @@ sink_prepare:
                        p->walking = false;
                        if (ret < 0) {
                                /* unprepare the source widget */
-                               if (!widget_ops[widget->id].ipc_unprepare && swidget->prepared) {
+                               if (widget_ops[widget->id].ipc_unprepare && swidget->prepared) {
                                        widget_ops[widget->id].ipc_unprepare(swidget);
                                        swidget->prepared = false;
                                }