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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
---
 sound/soc/sof/amd/acp-loader.c | 2 ++
 1 file changed, 2 insertions(+)

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,
-- 
2.40.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux