Skip to content

Commit bcb647c

Browse files
marc-hbgregkh
authored andcommitted
ASoC: SOF: loader: release_firmware() on load failure to avoid batching
[ Upstream commit 8a8e181 ] 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>
1 parent f6952b1 commit bcb647c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

sound/soc/sof/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ int snd_sof_device_remove(struct device *dev)
354354
dev_warn(dev, "error: %d failed to prepare DSP for device removal",
355355
ret);
356356

357-
snd_sof_fw_unload(sdev);
358357
snd_sof_ipc_free(sdev);
359358
snd_sof_free_debug(sdev);
360359
snd_sof_free_trace(sdev);
@@ -377,8 +376,7 @@ int snd_sof_device_remove(struct device *dev)
377376
snd_sof_remove(sdev);
378377

379378
/* release firmware */
380-
release_firmware(pdata->fw);
381-
pdata->fw = NULL;
379+
snd_sof_fw_unload(sdev);
382380

383381
return 0;
384382
}

sound/soc/sof/loader.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,5 +830,7 @@ EXPORT_SYMBOL(snd_sof_run_firmware);
830830
void snd_sof_fw_unload(struct snd_sof_dev *sdev)
831831
{
832832
/* TODO: support module unloading at runtime */
833+
release_firmware(sdev->pdata->fw);
834+
sdev->pdata->fw = NULL;
833835
}
834836
EXPORT_SYMBOL(snd_sof_fw_unload);

0 commit comments

Comments
 (0)