[PATCH] fabrics: parse nvme connect Linux error codes

amit.engel at dell.com amit.engel at dell.com
Mon Aug 1 11:40:39 PDT 2022


From: Amit Engel <amit.engel at dell.com>

This fixes the assumption that errval is an unsigned nvme error

Signed-off-by: Amit Engel <amit.engel at dell.com>
---
 drivers/nvme/host/fabrics.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 5207a2348257..cc84c4ea251b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -268,6 +268,13 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl,
 		int errval, int offset, struct nvme_command *cmd,
 		struct nvmf_connect_data *data)
 {
+
+	if (errval < 0) {
+		dev_err(ctrl->device,
+			"Connect command failed, Linux error code: %d\n", errval);
+		return;
+	}
+
 	int err_sctype = errval & ~NVME_SC_DNR;
 
 	switch (err_sctype) {
-- 
2.18.2




More information about the Linux-nvme mailing list