Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758045AbcLONVM (ORCPT ); Thu, 15 Dec 2016 08:21:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:37324 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758004AbcLONVL (ORCPT ); Thu, 15 Dec 2016 08:21:11 -0500 From: Johannes Thumshirn To: Keith Busch , Jens Axboe Cc: Christoph Hellwig , Sagi Grimberg , James Smart , Linux Kernel Mailinglist , linux-nvme@lists.infradead.org, Johannes Thumshirn Subject: [PATCH] nvme-fabrics: simplify error handling of nvme_fc_create_hw_io_queues Date: Thu, 15 Dec 2016 14:20:48 +0100 Message-Id: <20161215132048.12645-1-jthumshirn@suse.de> X-Mailer: git-send-email 2.10.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1045 Lines: 42 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 -- 1.8.5.6