[PATCH] habanalabs: added return value check for hl_fw_dynamic_send_clear_cmd()

From: Marco Pagani
Date: Wed Nov 16 2022 - 08:43:15 EST


The clang-analyzer reported a warning: "Value stored to 'rc' is never
read".

The return value check for the first hl_fw_dynamic_send_clear_cmd() call
in hl_fw_dynamic_send_protocol_cmd() appears to be missing.

Signed-off-by: Marco Pagani <marpagan@xxxxxxxxxx>
---
drivers/misc/habanalabs/common/firmware_if.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
index 2de6a9bd564d..311942108dbc 100644
--- a/drivers/misc/habanalabs/common/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -1782,6 +1782,8 @@ int hl_fw_dynamic_send_protocol_cmd(struct hl_device *hdev,

/* first send clear command to clean former commands */
rc = hl_fw_dynamic_send_clear_cmd(hdev, fw_loader);
+ if (rc)
+ return rc;

/* send the actual command */
hl_fw_dynamic_send_cmd(hdev, fw_loader, cmd, size);
--
2.38.1