diff mbox series

[SRU,J,1/4] nvme-fabrics: parse nvme connect Linux error codes

Message ID 20221111012626.39213-2-michael.reed@canonical.com
State New
Headers show
Series NVMe TCP - Host fails to reconnect to target after link down/link up sequence | expand

Commit Message

Michael Reed Nov. 11, 2022, 1:26 a.m. UTC
From: Amit Engel <amit.engel@dell.com>

This fixes the assumption that errval is an unsigned nvme error

Signed-off-by: Amit Engel <amit.engel@dell.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
(cherry picked from commit ec9e96b5230148294c7abcaf3a4c592d3720b62d)
Signed-off-by: Michael Reed <Michael.Reed@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1989990
---
 drivers/nvme/host/fabrics.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 668c6bb7a567..faf21483b26d 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -271,6 +271,12 @@  static void nvmf_log_connect_error(struct nvme_ctrl *ctrl,
 {
 	int err_sctype = errval & ~NVME_SC_DNR;
 
+	if (errval < 0) {
+		dev_err(ctrl->device,
+			"Connect command failed, errno: %d\n", errval);
+		return;
+	}
+
 	switch (err_sctype) {
 	case (NVME_SC_CONNECT_INVALID_PARAM):
 		if (offset >> 16) {