Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: cleanup nvme_tcp_recv_pdu
@ 2019-07-19 19:46 Sagi Grimberg
  2019-07-20  8:14 ` Minwoo Im
  0 siblings, 1 reply; 2+ messages in thread
From: Sagi Grimberg @ 2019-07-19 19:46 UTC (permalink / raw)


Can return directly in the switch statement

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/tcp.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 361e4bd6338e..8d4965031399 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -611,23 +611,18 @@ static int nvme_tcp_recv_pdu(struct nvme_tcp_queue *queue, struct sk_buff *skb,
 
 	switch (hdr->type) {
 	case nvme_tcp_c2h_data:
-		ret = nvme_tcp_handle_c2h_data(queue, (void *)queue->pdu);
-		break;
+		return nvme_tcp_handle_c2h_data(queue, (void *)queue->pdu);
 	case nvme_tcp_rsp:
 		nvme_tcp_init_recv_ctx(queue);
-		ret = nvme_tcp_handle_comp(queue, (void *)queue->pdu);
-		break;
+		return nvme_tcp_handle_comp(queue, (void *)queue->pdu);
 	case nvme_tcp_r2t:
 		nvme_tcp_init_recv_ctx(queue);
-		ret = nvme_tcp_handle_r2t(queue, (void *)queue->pdu);
-		break;
+		return nvme_tcp_handle_r2t(queue, (void *)queue->pdu);
 	default:
 		dev_err(queue->ctrl->ctrl.device,
 			"unsupported pdu type (%d)\n", hdr->type);
 		return -EINVAL;
 	}
-
-	return ret;
 }
 
 static inline void nvme_tcp_end_request(struct request *rq, u16 status)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] nvme-tcp: cleanup nvme_tcp_recv_pdu
  2019-07-19 19:46 [PATCH] nvme-tcp: cleanup nvme_tcp_recv_pdu Sagi Grimberg
@ 2019-07-20  8:14 ` Minwoo Im
  0 siblings, 0 replies; 2+ messages in thread
From: Minwoo Im @ 2019-07-20  8:14 UTC (permalink / raw)


On 19-07-19 12:46:46, Sagi Grimberg wrote:
> Can return directly in the switch statement
> 
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
>  drivers/nvme/host/tcp.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 361e4bd6338e..8d4965031399 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -611,23 +611,18 @@ static int nvme_tcp_recv_pdu(struct nvme_tcp_queue *queue, struct sk_buff *skb,
>  
>  	switch (hdr->type) {
>  	case nvme_tcp_c2h_data:
> -		ret = nvme_tcp_handle_c2h_data(queue, (void *)queue->pdu);
> -		break;
> +		return nvme_tcp_handle_c2h_data(queue, (void *)queue->pdu);
>  	case nvme_tcp_rsp:
>  		nvme_tcp_init_recv_ctx(queue);
> -		ret = nvme_tcp_handle_comp(queue, (void *)queue->pdu);
> -		break;
> +		return nvme_tcp_handle_comp(queue, (void *)queue->pdu);
>  	case nvme_tcp_r2t:
>  		nvme_tcp_init_recv_ctx(queue);
> -		ret = nvme_tcp_handle_r2t(queue, (void *)queue->pdu);
> -		break;
> +		return nvme_tcp_handle_r2t(queue, (void *)queue->pdu);
>  	default:
>  		dev_err(queue->ctrl->ctrl.device,
>  			"unsupported pdu type (%d)\n", hdr->type);
>  		return -EINVAL;
>  	}
> -
> -	return ret;
>  }

For the non-functional changes here by early-return:

Reviewed-by: Minwoo Im <minwoo.im.dev at gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-20  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-19 19:46 [PATCH] nvme-tcp: cleanup nvme_tcp_recv_pdu Sagi Grimberg
2019-07-20  8:14 ` Minwoo Im

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox