[Intel-xe] [PATCH 03/14] ASoC/SOF/core: Ensure sof_ops_free() is still called when probe never ran.

Jani Nikula jani.nikula at linux.intel.com
Tue Oct 3 07:58:16 UTC 2023


On Mon, 02 Oct 2023, maarten.lankhorst at linux.intel.com wrote:
> From: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>
> In an effort to not call sof_ops_free twice, we stopped running it when
> probe was aborted.
>
> Check the result of cancel_work_sync to see if this was the case.
>
> Fixes: 31bb7bd9ffee ("ASoC: SOF: core: Only call sof_ops_free() on remove if the probe was successful")
> Cc: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>
> Acked-by: Mark Brown <broonie at kernel.org>

IMO this and the subsequent patches need either

- cherry-pick -x annotation for patches that have already been merged to
  upstream trees

or

- Link: tag pointing at the patches on upstream mailing list for patches
  that haven't been merged yet


BR,
Jani.


> ---
>  sound/soc/sof/core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
> index 2d1616b81485..0938b259f703 100644
> --- a/sound/soc/sof/core.c
> +++ b/sound/soc/sof/core.c
> @@ -459,9 +459,10 @@ int snd_sof_device_remove(struct device *dev)
>  	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
>  	struct snd_sof_pdata *pdata = sdev->pdata;
>  	int ret;
> +	bool aborted = false;
>  
>  	if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))
> -		cancel_work_sync(&sdev->probe_work);
> +		aborted = cancel_work_sync(&sdev->probe_work);
>  
>  	/*
>  	 * Unregister any registered client device first before IPC and debugfs
> @@ -487,6 +488,9 @@ int snd_sof_device_remove(struct device *dev)
>  		snd_sof_free_debug(sdev);
>  		snd_sof_remove(sdev);
>  		sof_ops_free(sdev);
> +	} else if (aborted) {
> +		/* probe_work never ran */
> +		sof_ops_free(sdev);
>  	}
>  
>  	/* release firmware */

-- 
Jani Nikula, Intel


More information about the Intel-xe mailing list