summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Herbert <marc.herbert@intel.com>2021-09-16 11:50:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-17 10:43:32 +0200
commitbcb647c1e15d3ddd8ab94d556aa38d77448b40d9 (patch)
tree34b032ed89ecab8090feef8419075e668680a24e
parentf6952b1e22c2de8f23d59f944b0f17cb2733a846 (diff)
downloadlinux-stable-bcb647c1e15d3ddd8ab94d556aa38d77448b40d9.tar.gz
linux-stable-bcb647c1e15d3ddd8ab94d556aa38d77448b40d9.tar.bz2
linux-stable-bcb647c1e15d3ddd8ab94d556aa38d77448b40d9.zip
ASoC: SOF: loader: release_firmware() on load failure to avoid batching
[ Upstream commit 8a8e1813ffc35111fc0b6db49968ceb0e1615ced ] Invoke release_firmware() when the firmware fails to boot in sof_probe_continue(). The request_firmware() framework must be informed of failures in sof_probe_continue() otherwise its internal "batching" feature (different from caching) cached the firmware image forever. Attempts to correct the file in /lib/firmware/ were then silently and confusingly ignored until the next reboot. Unloading the drivers did not help because from their disconnected perspective the firmware had failed so there was nothing to release. Also leverage the new snd_sof_fw_unload() function to simplify the snd_sof_device_remove() function. Signed-off-by: Marc Herbert <marc.herbert@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20210916085008.28929-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--sound/soc/sof/core.c4
-rw-r--r--sound/soc/sof/loader.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index adc7c37145d6..feced9077dfe 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -354,7 +354,6 @@ int snd_sof_device_remove(struct device *dev)
dev_warn(dev, "error: %d failed to prepare DSP for device removal",
ret);
- snd_sof_fw_unload(sdev);
snd_sof_ipc_free(sdev);
snd_sof_free_debug(sdev);
snd_sof_free_trace(sdev);
@@ -377,8 +376,7 @@ int snd_sof_device_remove(struct device *dev)
snd_sof_remove(sdev);
/* release firmware */
- release_firmware(pdata->fw);
- pdata->fw = NULL;
+ snd_sof_fw_unload(sdev);
return 0;
}
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index ba9ed66f98bc..2d5c3fc93bc5 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -830,5 +830,7 @@ EXPORT_SYMBOL(snd_sof_run_firmware);
void snd_sof_fw_unload(struct snd_sof_dev *sdev)
{
/* TODO: support module unloading at runtime */
+ release_firmware(sdev->pdata->fw);
+ sdev->pdata->fw = NULL;
}
EXPORT_SYMBOL(snd_sof_fw_unload);