Skip to content

Commit

Permalink
nvmet-tcp: remove superflous check on request sgl
Browse files Browse the repository at this point in the history
Now that sgl_free is null safe, drop the superflous check.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
  • Loading branch information
Sagi Grimberg committed Sep 25, 2019
1 parent f03e42c commit 30f27d5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/nvme/target/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)

return 0;
err:
if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg);
sgl_free(cmd->req.sg);
return NVME_SC_INTERNAL;
}

Expand Down Expand Up @@ -554,8 +553,7 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd)

if (queue->nvme_sq.sqhd_disabled) {
kfree(cmd->iov);
if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg);
sgl_free(cmd->req.sg);
}

return 1;
Expand Down Expand Up @@ -586,8 +584,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd,
return -EAGAIN;

kfree(cmd->iov);
if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg);
sgl_free(cmd->req.sg);
cmd->queue->snd_cmd = NULL;
nvmet_tcp_put_cmd(cmd);
return 1;
Expand Down Expand Up @@ -1310,8 +1307,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd)
nvmet_req_uninit(&cmd->req);
nvmet_tcp_unmap_pdu_iovec(cmd);
kfree(cmd->iov);
if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg);
sgl_free(cmd->req.sg);
}

static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
Expand Down

0 comments on commit 30f27d5

Please sign in to comment.