diff options
author | Pierre-Louis Bossart <[email protected]> | 2019-10-22 14:28:43 -0500 |
---|---|---|
committer | Mark Brown <[email protected]> | 2019-10-23 17:45:45 +0100 |
commit | 76dc6a2b312d15c91ff4b4d171e98cdc73ba3745 (patch) | |
tree | 862bf63018f9fffd9cba8c5d8c781c0f9ecca6ff | |
parent | ef5dee551e3e6568fb203ea57fa24f55cb64d451 (diff) |
ASoC: SOF: Intel: hda-loader: improve error handling
If a ROM timeout is detected, we still stop the DMA but will return
the initial error should the DMA stop also fail.
Likewise the cleanup is handled regardless of the status, but we
return the initial error.
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
-rw-r--r-- | sound/soc/sof/intel/hda-loader.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index 65c2af3fcaab..7956dbf5be88 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -253,10 +253,16 @@ static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream) HDA_DSP_REG_POLL_INTERVAL_US, HDA_DSP_BASEFW_TIMEOUT_US); + /* + * even in case of errors we still need to stop the DMAs, + * but we return the initial error should the DMA stop also fail + */ + ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP); if (ret < 0) { dev_err(sdev->dev, "error: DMA trigger stop failed\n"); - return ret; + if (!status) + status = ret; } return status; @@ -341,13 +347,15 @@ cleanup: /* * Perform codeloader stream cleanup. * This should be done even if firmware loading fails. + * If the cleanup also fails, we return the initial error */ ret1 = cl_cleanup(sdev, &sdev->dmab, stream); if (ret1 < 0) { dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); /* set return value to indicate cleanup failure */ - ret = ret1; + if (!ret) + ret = ret1; } /* |