[PATCH 5/9] nvme-core: use normal pattern

Sagi Grimberg sagi at grimberg.me
Thu Mar 23 01:04:44 PDT 2023


> Although return is allowed in the switch ... case when function is
> returing void, it creates confusion for future code which is desirable
> pattern to use for switch ... case. Repalce return in the switch with
> break that is standard pattern for the switch ... case.

Don't see the confusion, but ok,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>


> 
> Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
> ---
>   drivers/nvme/host/core.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index a380938f5a06..3eb2299a81fc 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -403,13 +403,13 @@ void nvme_complete_rq(struct request *req)
>   	switch (nvme_decide_disposition(req)) {
>   	case COMPLETE:
>   		nvme_end_req(req);
> -		return;
> +		break;
>   	case RETRY:
>   		nvme_retry_req(req);
> -		return;
> +		break;
>   	case FAILOVER:
>   		nvme_failover_req(req);
> -		return;
> +		break;
>   	case AUTHENTICATE:
>   #ifdef CONFIG_NVME_AUTH
>   		queue_work(nvme_wq, &ctrl->dhchap_auth_work);
> @@ -417,7 +417,7 @@ void nvme_complete_rq(struct request *req)
>   #else
>   		nvme_end_req(req);
>   #endif
> -		return;
> +		break;
>   	}
>   }
>   EXPORT_SYMBOL_GPL(nvme_complete_rq);



More information about the Linux-nvme mailing list