Skip to contentSkip to conversation

nvme/core:disable streams when get stream params failed

PATCH Applied Wu Bo 2 participants 2 messages May 13, 2020 – May 14, 2020 NVMe

lore
Share & tools
lore

Wu Bo

author
#0 lore raw

PATCH v2 1/1 nvme/core:disable streams when get stream params failed

After enable nvme streams, then if get stream params failed, We should disable streams before return error in nvme_configure_directives() function.

---
 drivers/nvme/host/core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/nvme/host/core.c +6 -3
index f3c037f..29bef53 100644
@@ -553,19 +553,22 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
 
 	ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
 	if (ret)
-		return ret;
+		goto out_disable_stream;
 
 	ctrl->nssa = le16_to_cpu(s.nssa);
 	if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
 		dev_info(ctrl->device, "too few streams (%u) available\n",
 					ctrl->nssa);
-		nvme_disable_streams(ctrl);
-		return 0;
+		goto out_disable_stream;
 	}
 
 	ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1);
 	dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams);
 	return 0;
+
+out_disable_stream:
+	nvme_disable_streams(ctrl);
+	return ret;
 }
 
 /*
Signature · 1 line
1.8.3.1