summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorOded Gabbay <ogabbay@kernel.org>2022-06-30 09:30:49 +0300
committerOded Gabbay <ogabbay@kernel.org>2022-07-12 09:09:29 +0300
commit18913d68701918d784809e4b9462f51a7270e840 (patch)
treece33f223c516b81b4ac8415ae1d33544d204ad85 /drivers/misc
parentea9770e653eecb40422e905b29d3e6b155b5ee3e (diff)
downloadlinux-18913d68701918d784809e4b9462f51a7270e840.tar.bz2
habanalabs: allow detection of unsupported f/w packets
If we send a packet to the f/w, and that packet is unsupported, we want to be able to identify this situation and possibly ignore this. Therefore, if the f/w returned an error, we need to propagate it to the callers in the result value, if those callers were interested in it. In addition, no point of printing the error code here because each caller prints its own error with a specific message. Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/firmware_if.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
index 04ca4aaee446..fd8dd332a59a 100644
--- a/drivers/misc/habanalabs/common/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -327,11 +327,15 @@ int hl_fw_send_cpu_message(struct hl_device *hdev, u32 hw_queue_id, u32 *msg,
rc = (tmp & CPUCP_PKT_CTL_RC_MASK) >> CPUCP_PKT_CTL_RC_SHIFT;
if (rc) {
- dev_err(hdev->dev, "F/W ERROR %d for CPU packet %d\n",
- rc,
- (tmp & CPUCP_PKT_CTL_OPCODE_MASK)
- >> CPUCP_PKT_CTL_OPCODE_SHIFT);
+ dev_dbg(hdev->dev, "F/W ERROR %d for CPU packet %d\n",
+ rc, (tmp & CPUCP_PKT_CTL_OPCODE_MASK) >> CPUCP_PKT_CTL_OPCODE_SHIFT);
+
+ /* propagate the return code from the f/w to the callers who want to check it */
+ if (result)
+ *result = rc;
+
rc = -EIO;
+
} else if (result) {
*result = le64_to_cpu(pkt->result);
}