Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755979AbcLOQh3 (ORCPT ); Thu, 15 Dec 2016 11:37:29 -0500 Received: from mail-wj0-f176.google.com ([209.85.210.176]:36839 "EHLO mail-wj0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327AbcLOQh2 (ORCPT ); Thu, 15 Dec 2016 11:37:28 -0500 Subject: Re: [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues To: Johannes Thumshirn , Keith Busch , Jens Axboe References: <20161215132048.12645-1-jthumshirn@suse.de> Cc: Christoph Hellwig , Sagi Grimberg , Linux Kernel Mailinglist , linux-nvme@lists.infradead.org From: James Smart Message-ID: <82b700f4-7a4c-777d-e7c2-b934548a71ba@broadcom.com> Date: Thu, 15 Dec 2016 08:37:21 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161215132048.12645-1-jthumshirn@suse.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1254 Lines: 50 Looks fine -- james Signed-off-by: James Smart 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 > --- > 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