From: Maarten Lankhorst Date: Mon, 9 Oct 2023 11:54:25 +0000 (+0200) Subject: ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran. X-Git-Tag: v6.1.63~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=002bd3c874da7f1306d82abad6d8517d20f3c588;p=sdk%2Femulator%2Femulator-kernel.git ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran. [ Upstream commit f549a82aff57865c47b5abd17336b23cd9bb2d2c ] 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 Acked-by: Mark Brown Reviewed-by: Peter Ujfalusi Acked-by: Peter Ujfalusi Signed-off-by: Maarten Lankhorst Link: https://lore.kernel.org/r/20231009115437.99976-2-maarten.lankhorst@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index eaa16755a270..93e1c38392a3 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -434,9 +434,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 @@ -462,6 +463,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 */