Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191022192844.21022-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
76dc6a2b ef5dee55

+10 -2
+10 -2
sound/soc/sof/intel/hda-loader.c
··· 253 253 HDA_DSP_REG_POLL_INTERVAL_US, 254 254 HDA_DSP_BASEFW_TIMEOUT_US); 255 255 256 + /* 257 + * even in case of errors we still need to stop the DMAs, 258 + * but we return the initial error should the DMA stop also fail 259 + */ 260 + 256 261 ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP); 257 262 if (ret < 0) { 258 263 dev_err(sdev->dev, "error: DMA trigger stop failed\n"); 259 - return ret; 264 + if (!status) 265 + status = ret; 260 266 } 261 267 262 268 return status; ··· 347 341 /* 348 342 * Perform codeloader stream cleanup. 349 343 * This should be done even if firmware loading fails. 344 + * If the cleanup also fails, we return the initial error 350 345 */ 351 346 ret1 = cl_cleanup(sdev, &sdev->dmab, stream); 352 347 if (ret1 < 0) { 353 348 dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); 354 349 355 350 /* set return value to indicate cleanup failure */ 356 - ret = ret1; 351 + if (!ret) 352 + ret = ret1; 357 353 } 358 354 359 355 /*