]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: SOF: core: Only call sof_ops_free() on remove if the probe was successful
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 15 Sep 2023 12:40:15 +0000 (15:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Oct 2023 12:56:37 +0000 (14:56 +0200)
[ Upstream commit 31bb7bd9ffee50d09ec931998b823a86132ab807 ]

All the fail paths during probe will free up the ops, on remove we should
only free it if the probe was successful.

Fixes: bc433fd76fae ("ASoC: SOF: Add ops_free")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230915124015.19637-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/sof/core.c

index 75a1e2c6539f22d617b39f5d2a9d19c03e8b24fc..eaa16755a27048fb62b00dbd431788e11c6d78b6 100644 (file)
@@ -461,10 +461,9 @@ int snd_sof_device_remove(struct device *dev)
                snd_sof_ipc_free(sdev);
                snd_sof_free_debug(sdev);
                snd_sof_remove(sdev);
+               sof_ops_free(sdev);
        }
 
-       sof_ops_free(sdev);
-
        /* release firmware */
        snd_sof_fw_unload(sdev);