nvmet: remove duplicate NULL initialization for req->ns
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Thu, 10 May 2018 06:46:30 +0000 (02:46 -0400)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 May 2018 14:50:12 +0000 (16:50 +0200)
Remove the duplicate NULL initialization for req->ns.  req->ns is always
initialized to NULL in nvmet_req_init(), so there is no need to reset
it later on failures unless we have previously assigned a value to it.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/core.c
drivers/nvme/target/discovery.c
drivers/nvme/target/fabrics-cmd.c
drivers/nvme/target/io-cmd.c

index 5e0e9fcc0d4dcd874fb4c008e6e8f02c51ca47ba..d1afcfd89aa3a1f56521f234b660739776c08de8 100644 (file)
@@ -548,8 +548,6 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
        struct nvme_command *cmd = req->cmd;
        u16 ret;
 
-       req->ns = NULL;
-
        ret = nvmet_check_ctrl_status(req, cmd);
        if (unlikely(ret))
                return ret;
index 4a9908bb7de0a4118741bcc648ff244676bbcb60..6d8eaf3f89c57e09403e03920c667ab51f3231b7 100644 (file)
@@ -718,7 +718,6 @@ u16 nvmet_check_ctrl_status(struct nvmet_req *req, struct nvme_command *cmd)
        if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
                pr_err("got cmd %d while CSTS.RDY == 0 on qid = %d\n",
                       cmd->common.opcode, req->sq->qid);
-               req->ns = NULL;
                return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
        }
        return 0;
index 231e04e0a496b31d6b7a1a47bff369fe6f91cdeb..08656b849bd6efdd4762a930b2a2bfa895da3292 100644 (file)
@@ -187,8 +187,6 @@ u16 nvmet_parse_discovery_cmd(struct nvmet_req *req)
 {
        struct nvme_command *cmd = req->cmd;
 
-       req->ns = NULL;
-
        if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
                pr_err("got cmd %d while not ready\n",
                       cmd->common.opcode);
index 19e9e42ae94307233e82ffbf864294875d8aa39f..d84ae004cb85cb96df5e26b9799ffcc047f71aad 100644 (file)
@@ -77,8 +77,6 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
 {
        struct nvme_command *cmd = req->cmd;
 
-       req->ns = NULL;
-
        switch (cmd->fabrics.fctype) {
        case nvme_fabrics_type_property_set:
                req->data_len = 0;
@@ -242,8 +240,6 @@ u16 nvmet_parse_connect_cmd(struct nvmet_req *req)
 {
        struct nvme_command *cmd = req->cmd;
 
-       req->ns = NULL;
-
        if (cmd->common.opcode != nvme_fabrics_command) {
                pr_err("invalid command 0x%x on unconnected queue.\n",
                        cmd->fabrics.opcode);
index cd23441796731960e76b9d3b07b48f18572aa20b..e5eb2db4d20fa28338876535c903af821d1fa303 100644 (file)
@@ -195,10 +195,8 @@ u16 nvmet_parse_io_cmd(struct nvmet_req *req)
        u16 ret;
 
        ret = nvmet_check_ctrl_status(req, cmd);
-       if (unlikely(ret)) {
-               req->ns = NULL;
+       if (unlikely(ret))
                return ret;
-       }
 
        req->ns = nvmet_find_namespace(req->sq->ctrl, cmd->rw.nsid);
        if (unlikely(!req->ns))