All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
@ 2016-12-15 13:20 ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2016-12-15 13:20 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe
  Cc: Christoph Hellwig, Sagi Grimberg, James Smart,
	Linux Kernel Mailinglist, linux-nvme, Johannes Thumshirn

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

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

* [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
@ 2016-12-15 13:20 ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2016-12-15 13:20 UTC (permalink / raw)


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 at 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

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

* Re: [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
  2016-12-15 13:20 ` Johannes Thumshirn
@ 2016-12-15 16:37   ` James Smart
  -1 siblings, 0 replies; 4+ messages in thread
From: James Smart @ 2016-12-15 16:37 UTC (permalink / raw)
  To: Johannes Thumshirn, Keith Busch, Jens Axboe
  Cc: Christoph Hellwig, Sagi Grimberg, Linux Kernel Mailinglist, linux-nvme

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

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

* [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues
@ 2016-12-15 16:37   ` James Smart
  0 siblings, 0 replies; 4+ messages in thread
From: James Smart @ 2016-12-15 16:37 UTC (permalink / raw)


Looks fine

-- james


Signed-off-by: James Smart <james.smart at 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 at 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

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

end of thread, other threads:[~2016-12-15 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-15 13:20 [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues Johannes Thumshirn
2016-12-15 13:20 ` Johannes Thumshirn
2016-12-15 16:37 ` James Smart
2016-12-15 16:37   ` James Smart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.