Re: [PATCH 1/2] nvmet-auth: remove unnecessary break after goto

Chaitanya Kulkarni
2023-05-20T08:02:49Z

On 5/19/2023 10:01 PM, Christoph Hellwig wrote:
> On Fri, May 19, 2023 at 02:40:51AM -0700, Chaitanya Kulkarni wrote:
>> 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.

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