summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorKai Vehmanen <kai.vehmanen@linux.intel.com>2019-05-09 22:10:23 +0200
committerMark Brown <broonie@kernel.org>2019-05-13 13:37:12 +0200
commita69270d8bfeb35fc89d047ea6db803cd75a74f12 (patch)
tree4e59a25e93eada96c8d0e74b3d976f730fa5670f /sound/soc
parentASoC: SOF: nocodec: fix undefined reference (diff)
downloadlinux-a69270d8bfeb35fc89d047ea6db803cd75a74f12.tar.xz
linux-a69270d8bfeb35fc89d047ea6db803cd75a74f12.zip
ASoC: SOF: fix race in FW boot timeout handling
A race condition exists in handling firmware boot timeout. If FW sends FW_READY just after boot timeout has expired in driver, a kernel exception will result as FW_READY handler will be run while the state is still being cleaned up in snd_sof_run_firmware(). Avoid the race by setting boot_complete also in the error case. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/sof/loader.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 81c7452aae17..628fae552442 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -372,6 +372,8 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
msecs_to_jiffies(sdev->boot_timeout));
if (ret == 0) {
dev_err(sdev->dev, "error: firmware boot failure\n");
+ /* after this point FW_READY msg should be ignored */
+ sdev->boot_complete = true;
snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX |
SOF_DBG_TEXT | SOF_DBG_PCI);
return -EIO;