diff mbox series

[2/4] ASoC: SOF: amd: acp-loader: abort firmware download on write error

Message ID 20240402145959.172619-3-pierre-louis.bossart@linux.intel.com
State Accepted
Commit dbb6ca68b55ddf23d0b6de782c7641624a285fc2
Headers show
Series ASoC: SOF: cppcheck fixes and debugfs addition | expand

Commit Message

Pierre-Louis Bossart April 2, 2024, 2:59 p.m. UTC
cppcheck reports this issue:

sound/soc/sof/amd/acp-loader.c:299:6: style: Variable 'ret' is
reassigned a value before the old one has been
used. [redundantAssignment]
 ret = request_firmware(&adata->fw_dbin, fw_filename, sdev->dev);
     ^
sound/soc/sof/amd/acp-loader.c:289:6: note: ret is assigned
 ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM, 0,
     ^
sound/soc/sof/amd/acp-loader.c:299:6: note: ret is overwritten
 ret = request_firmware(&adata->fw_dbin, fw_filename, sdev->dev);
     ^

This behavior is probably unintentional, there's no reason to return
an error for the DRAM but not the IRAM.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 sound/soc/sof/amd/acp-loader.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/amd/acp-loader.c b/sound/soc/sof/amd/acp-loader.c
index aad904839b81..2d5e58846499 100644
--- a/sound/soc/sof/amd/acp-loader.c
+++ b/sound/soc/sof/amd/acp-loader.c
@@ -289,6 +289,8 @@  int acp_sof_load_signed_firmware(struct snd_sof_dev *sdev)
 	ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM, 0,
 				      (void *)sdev->basefw.fw->data,
 				      sdev->basefw.fw->size);
+	if (ret < 0)
+		return ret;
 
 	fw_filename = kasprintf(GFP_KERNEL, "%s/%s",
 				plat_data->fw_filename_prefix,