OSDN Git Service

nvme: disable streams when get stream params failed
authorWu Bo <wubo40@huawei.com>
Wed, 13 May 2020 08:18:13 +0000 (16:18 +0800)
committerChristoph Hellwig <hch@lst.de>
Wed, 27 May 2020 05:12:37 +0000 (07:12 +0200)
Disable streams again if getting the stream params fails.

Signed-off-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c

index 805d289..43a6336 100644 (file)
@@ -552,19 +552,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;
 }
 
 /*