Commit 618cff42 authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Christoph Hellwig

nvmet: remove duplicate NULL initialization for req->ns

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: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent b40b83e3
...@@ -548,8 +548,6 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req) ...@@ -548,8 +548,6 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
struct nvme_command *cmd = req->cmd; struct nvme_command *cmd = req->cmd;
u16 ret; u16 ret;
req->ns = NULL;
ret = nvmet_check_ctrl_status(req, cmd); ret = nvmet_check_ctrl_status(req, cmd);
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
......
...@@ -718,7 +718,6 @@ u16 nvmet_check_ctrl_status(struct nvmet_req *req, struct nvme_command *cmd) ...@@ -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))) { if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
pr_err("got cmd %d while CSTS.RDY == 0 on qid = %d\n", pr_err("got cmd %d while CSTS.RDY == 0 on qid = %d\n",
cmd->common.opcode, req->sq->qid); cmd->common.opcode, req->sq->qid);
req->ns = NULL;
return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR; return NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR;
} }
return 0; return 0;
......
...@@ -187,8 +187,6 @@ u16 nvmet_parse_discovery_cmd(struct nvmet_req *req) ...@@ -187,8 +187,6 @@ u16 nvmet_parse_discovery_cmd(struct nvmet_req *req)
{ {
struct nvme_command *cmd = req->cmd; struct nvme_command *cmd = req->cmd;
req->ns = NULL;
if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) { if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) {
pr_err("got cmd %d while not ready\n", pr_err("got cmd %d while not ready\n",
cmd->common.opcode); cmd->common.opcode);
......
...@@ -77,8 +77,6 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req) ...@@ -77,8 +77,6 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
{ {
struct nvme_command *cmd = req->cmd; struct nvme_command *cmd = req->cmd;
req->ns = NULL;
switch (cmd->fabrics.fctype) { switch (cmd->fabrics.fctype) {
case nvme_fabrics_type_property_set: case nvme_fabrics_type_property_set:
req->data_len = 0; req->data_len = 0;
...@@ -242,8 +240,6 @@ u16 nvmet_parse_connect_cmd(struct nvmet_req *req) ...@@ -242,8 +240,6 @@ u16 nvmet_parse_connect_cmd(struct nvmet_req *req)
{ {
struct nvme_command *cmd = req->cmd; struct nvme_command *cmd = req->cmd;
req->ns = NULL;
if (cmd->common.opcode != nvme_fabrics_command) { if (cmd->common.opcode != nvme_fabrics_command) {
pr_err("invalid command 0x%x on unconnected queue.\n", pr_err("invalid command 0x%x on unconnected queue.\n",
cmd->fabrics.opcode); cmd->fabrics.opcode);
......
...@@ -195,10 +195,8 @@ u16 nvmet_parse_io_cmd(struct nvmet_req *req) ...@@ -195,10 +195,8 @@ u16 nvmet_parse_io_cmd(struct nvmet_req *req)
u16 ret; u16 ret;
ret = nvmet_check_ctrl_status(req, cmd); ret = nvmet_check_ctrl_status(req, cmd);
if (unlikely(ret)) { if (unlikely(ret))
req->ns = NULL;
return ret; return ret;
}
req->ns = nvmet_find_namespace(req->sq->ctrl, cmd->rw.nsid); req->ns = nvmet_find_namespace(req->sq->ctrl, cmd->rw.nsid);
if (unlikely(!req->ns)) if (unlikely(!req->ns))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment