[PATCH] ASoC: SOF: Fix potential NULL pointer dereference

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Fri Jun 3 21:38:18 CEST 2022


On Thu, 2022-06-02 at 15:57 +0200, Amadeusz Sławiński wrote:
> 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.
> 
> Fixes: 370014c8197a ("ASoC: SOF: Add a prepare op to IPC topology
> widget ops")
> Signed-off-by: Amadeusz Sławiński <
> amadeuszx.slawinski at linux.intel.com>
> ---
>  sound/soc/sof/sof-audio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM. Thanks for the fix.
Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> 
> diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
> index cd41d0599cef..789d0a1f1a77 100644
> --- a/sound/soc/sof/sof-audio.c
> +++ b/sound/soc/sof/sof-audio.c
> @@ -323,7 +323,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev
> *sdev, struct snd_soc_dapm_widget
>  			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;
>  				}



More information about the Alsa-devel mailing list