Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542730 > unrolled thread

[PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues

Started byJohannes Thumshirn <jthumshirn@suse.de>
First post2016-12-15 14:30 +0100
Last post2016-12-15 17:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues Johannes Thumshirn <jthumshirn@suse.de> - 2016-12-15 14:30 +0100
    Re: [PATCH] nvme-fabrics: simplify error handling of  nvme_fc_create_hw_io_queues James Smart <james.smart@broadcom.com> - 2016-12-15 17:40 +0100

#1542730 — [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2016-12-15 14:30 +0100
Subject[PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
Message-ID<sOEgG-6fO-7@gated-at.bofh.it>
Simplify the error handling of nvme_fc_create_hw_io_queues(), this saves us
one variable and one level of indentation.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/host/fc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 771e2e7..ca2fd02 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1491,19 +1491,20 @@ enum {
 nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
 {
 	struct nvme_fc_queue *queue = &ctrl->queues[1];
-	int i, j, ret;
+	int i, ret;
 
 	for (i = 1; i < ctrl->queue_count; i++, queue++) {
 		ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize);
-		if (ret) {
-			for (j = i-1; j >= 0; j--)
-				__nvme_fc_delete_hw_queue(ctrl,
-						&ctrl->queues[j], j);
-			return ret;
-		}
+		if (ret)
+			goto delete_queues;
 	}
 
 	return 0;
+
+delete_queues:
+	for (; i >= 0; i--)
+		__nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i);
+	return ret;
 }
 
 static int
-- 
1.8.5.6

[toc] | [next] | [standalone]


#1542874 — Re: [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues

FromJames Smart <james.smart@broadcom.com>
Date2016-12-15 17:40 +0100
SubjectRe: [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
Message-ID<sOHey-83M-37@gated-at.bofh.it>
In reply to#1542730
Looks fine

-- james


Signed-off-by: James Smart <james.smart@broadcom.com>



On 12/15/2016 5:20 AM, Johannes Thumshirn wrote:
> Simplify the error handling of nvme_fc_create_hw_io_queues(), this saves us
> one variable and one level of indentation.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>   drivers/nvme/host/fc.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 771e2e7..ca2fd02 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -1491,19 +1491,20 @@ enum {
>   nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
>   {
>   	struct nvme_fc_queue *queue = &ctrl->queues[1];
> -	int i, j, ret;
> +	int i, ret;
>   
>   	for (i = 1; i < ctrl->queue_count; i++, queue++) {
>   		ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize);
> -		if (ret) {
> -			for (j = i-1; j >= 0; j--)
> -				__nvme_fc_delete_hw_queue(ctrl,
> -						&ctrl->queues[j], j);
> -			return ret;
> -		}
> +		if (ret)
> +			goto delete_queues;
>   	}
>   
>   	return 0;
> +
> +delete_queues:
> +	for (; i >= 0; i--)
> +		__nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i);
> +	return ret;
>   }
>   
>   static int

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web