Skip to contentSkip to conversation

nvmet-auth: clean up with done_kfree

PATCH Applied Jackie Liu 5 participants 9 messages Aug 12, 2022 – Sep 5, 2022

Subsystems (3)
lore
Share & tools
lore

Jackie Liu

author
#0 lore raw

PATCH 1/2 nvmet-auth: clean up with done_kfree

From: Jackie Liu <[email protected]>

Jump directly to done_kfree to release d, which is consistent with the code style behind.

---
 drivers/nvme/target/fabrics-cmd-auth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/nvme/target/fabrics-cmd-auth.c +2 -4
index c851814d6cb0..17c19614b929 100644
@@ -229,10 +229,8 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 	}
 
 	status = nvmet_copy_from_sgl(req, 0, d, tl);
-	if (status) {
-		kfree(d);
-		goto done;
-	}
+	if (status)
+		goto done_kfree;
 
 	data = d;
 	pr_debug("%s: ctrl %d qid %d type %d id %d step %x\n", __func__,
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 nvme-auth: remove the redundant req->cqe->result.u16 assignment operation

From: Jackie Liu <[email protected]>

req->cqe->result.u16 has already been assigned in the previous line, no need to do it again.

---
 drivers/nvme/target/fabrics-cmd.c | 1 -
 1 file changed, 1 deletion(-)
drivers/nvme/target/fabrics-cmd.c +0 -1
index f91a56180d3d..c1dfdfb92ebf 100644
@@ -332,7 +332,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
 	req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
 
 	pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid);
-	req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
 	if (nvmet_has_auth(ctrl))
 		nvmet_init_auth(ctrl, req);
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] nvme-auth: remove the redundant req->cqe->result.u16 assignment operation

Quoted 15 lines · Jackie Liu

From: Jackie Liu <[email protected]>

req->cqe->result.u16 has already been assigned in the previous line, no need to do it again.

---
  drivers/nvme/target/fabrics-cmd.c | 1 -
  1 file changed, 1 deletion(-)
drivers/nvme/target/fabrics-cmd.c +0 -0
index f91a56180d3d..c1dfdfb92ebf 100644

drivers/nvme/target/fabrics-cmd.c static void nvmet_execute_io_connect(struct nvmet_req *req) · line 337

Quoted 7 lines
drivers/nvme/target/fabrics-cmd.c +0 -1
@@ -332,7 +332,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
  	req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
 
  	pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid);
-	req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid);
  	if (nvmet_has_auth(ctrl))
  		nvmet_init_auth(ctrl, req);
 

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman
maintainer Reviewed-by on v1 1/2
#5 lore raw
In reply to Jackie Liu
Quoted 18 lines · Jackie Liu

From: Jackie Liu <[email protected]>

Jump directly to done_kfree to release d, which is consistent with the code style behind.

---
  drivers/nvme/target/fabrics-cmd-auth.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/nvme/target/fabrics-cmd-auth.c +0 -0
index c851814d6cb0..17c19614b929 100644
@@ -229,10 +229,8 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
  	}
 

drivers/nvme/target/fabrics-cmd-auth.c void nvmet_execute_auth_send(struct nvmet_req *req) · line 236

Quoted 10 lines
drivers/nvme/target/fabrics-cmd-auth.c +2 -4
  	status = nvmet_copy_from_sgl(req, 0, d, tl);
-	if (status) {
-		kfree(d);
-		goto done;
-	}
+	if (status)
+		goto done_kfree;
 
  	data = d;
  	pr_debug("%s: ctrl %d qid %d type %d id %d step %x\n", __func__,

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman