nvmet-auth: remove unnecessary break after goto
Subsystems (4)
Chaitanya Kulkarni
maintainerPATCH 1/2 nvmet-auth: remove unnecessary break after goto
Remove dead break after goto.
--- drivers/nvme/target/fabrics-cmd-auth.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/nvme/target/fabrics-cmd-auth.c +0 -4
@@ -295,13 +295,11 @@ void nvmet_execute_auth_send(struct nvmet_req *req) status =0 ; } goto done_kfree; -break ;case NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 : req->sq->authenticated = true;pr_debug ("%s: ctrl %d qid %d ctrl authenticated\n" , __func__, ctrl->cntlid, req->sq->qid); goto done_kfree; -break ;case NVME_AUTH_DHCHAP_MESSAGE_FAILURE2 : status =nvmet_auth_failure2 (d);if (status) {
@@ -312,7 +310,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req) status =0 ; } goto done_kfree; -break ;default : req->sq->dhchap_status =NVME_AUTH_DHCHAP_FAILURE_INCORRECT_MESSAGE ;
@@ -320,7 +317,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req)NVME_AUTH_DHCHAP_MESSAGE_FAILURE2 ; req->sq->authenticated = false; goto done_kfree; -break ; } done_failure1: req->sq->dhchap_status =NVME_AUTH_DHCHAP_FAILURE_INCORRECT_MESSAGE ;
Signature · 1 line
2.40.0
Chaitanya Kulkarni
maintainerPATCH 2/2 nvme-fcloop: no need to return from void function
Remove return at the end of void function.
--- drivers/nvme/target/fcloop.c | 2 -- 1 file changed, 2 deletions(-)
drivers/nvme/target/fcloop.c +0 -2
@@ -645,8 +645,6 @@ fcloop_fcp_recv_work(struct work_struct *work) }if (ret)fcloop_call_host_done (fcpreq, tfcp_req, ret); - -return ; } static void
Signature · 1 line
2.40.0
Re: [PATCH 2/2] nvme-fcloop: no need to return from void function
Looks good:
Re: [PATCH 2/2] nvme-fcloop: no need to return from void function
In reply to Chaitanya KulkarniHi CK,
Quoted 12 lines · Chaitanya Kulkarni
Remove return at the end of void function.
Signed-off-by Chaitanya Kulkarni <[email protected]>--- drivers/nvme/target/fcloop.c | 2 -- 1 file changed, 2 deletions(-)drivers/nvme/target/fcloop.c +0
-0
drivers/nvme/target/fcloop.c fcloop_fcp_recv_work(struct work_struct *work) · line 650
Quoted 8 lines
drivers/nvme/target/fcloop.c +0
-2@@ -645,8 +645,6 @@ fcloop_fcp_recv_work(struct work_struct *work) }if (ret)fcloop_call_host_done (fcpreq, tfcp_req, ret); - -return ; } static void
Looks good,
BTW, are patches 1/2 and 2/2 related to each other ? Can you split between them please if not related.
Re: [PATCH 2/2] nvme-fcloop: no need to return from void function
In reply to Chaitanya KulkarniQuoted 19 lines · Chaitanya Kulkarni
Remove return at the end of void function.
Signed-off-by Chaitanya Kulkarni <[email protected]>---
drivers/nvme/target/fcloop.c| 2 --1 file changed, 2 deletions(-)drivers/nvme/target/fcloop.c +0
-2@@ -645,8 +645,6 @@ fcloop_fcp_recv_work(struct work_struct *work) }if (ret)fcloop_call_host_done (fcpreq, tfcp_req, ret); - -return ; }
Quoted 5 lines
static void
Signature · 1 line
2.40.0
Christoph Hellwig
maintainerQuoted 1 line · Chaitanya Kulkarni
Remove dead break after goto.
As a trivial cleanup this looks fine, but I really hate the structure of this code.
Can't we have local variables that we set to the dhchap_status and dhchap_step, and then after the done label just conditionally assign them if dhchap_status is non-zero? This should clean up a lot of mess, especially we'd be done to very few assignments of the step, and we could avoid jumping out of the switch entirely.
Quoted 11 lines · Christoph Hellwig
Quoted 1 line · Chaitanya Kulkarni
Remove dead break after goto.
As a trivial cleanup this looks fine, but I really hate the structure of this code.
Can't we have local variables that we set to the
dhchap_statusanddhchap_step, and then after the done label just conditionally assign them ifdhchap_statusis non-zero? This should clean up a lot of mess, especially we'd be done to very few assignments of the step, and we could avoid jumping out of the switch entirely.
similar cleanup is also needed in nvmet_execute_auth_receive(), in general nvmet_execute_auth_receive() and nvmet_execute_auth_send() has a lot of common code that can use cleanup, I've a series on the top of this one ..
but prior to that we need these two patches to make both functions close enough so I can send a final cleanup on the top of this ..
-ck
Thanks, applied both for nvme-6.5. Looking forward to your follow up clean up that depended on this :)
Quoted 40 lines · Chaitanya Kulkarni
Remove dead break after goto.
Signed-off-by Chaitanya Kulkarni <[email protected]>---
drivers/nvme/target/fabrics-cmd-auth.c| 4 ----1 file changed, 4 deletions(-)drivers/nvme/target/fabrics-cmd-auth.c +0
-4@@ -295,13 +295,11 @@ void nvmet_execute_auth_send(struct nvmet_req *req) status =0 ; } goto done_kfree; -break ;case NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 : req->sq->authenticated = true;pr_debug ("%s: ctrl %d qid %d ctrl authenticated\n" , __func__, ctrl->cntlid, req->sq->qid); goto done_kfree; -break ;case NVME_AUTH_DHCHAP_MESSAGE_FAILURE2 : status =nvmet_auth_failure2 (d);if (status) {@@ -312,7 +310,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req) status =0 ; } goto done_kfree; -break ;default : req->sq->dhchap_status =NVME_AUTH_DHCHAP_FAILURE_INCORRECT_MESSAGE ;@@ -320,7 +317,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req)NVME_AUTH_DHCHAP_MESSAGE_FAILURE2 ; req->sq->authenticated = false; goto done_kfree; -break ; }
done_failure1:
Quoted 5 lines
req->sq->dhchap_status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_MESSAGE;Signature · 1 line
2.40.0