From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752559AbdBIJaz (ORCPT ); Thu, 9 Feb 2017 04:30:55 -0500 Received: from mx2.suse.de ([195.135.220.15]:50029 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529AbdBIJa3 (ORCPT ); Thu, 9 Feb 2017 04:30:29 -0500 Subject: Re: [PATCH 04/14] RDMA/cxgb4: Use common error handling code in recover_queues() To: SF Markus Elfring , linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: Johannes Thumshirn Message-ID: Date: Thu, 9 Feb 2017 10:30:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/08/2017 10:14 PM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 8 Feb 2017 15:51:58 +0100 > > Add a jump target so that a bit of exception handling can be better reused > at the end of this function. > > Signed-off-by: Markus Elfring > --- > drivers/infiniband/hw/cxgb4/device.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c > index 444c28206dae..46410c4a9afb 100644 > --- a/drivers/infiniband/hw/cxgb4/device.c > +++ b/drivers/infiniband/hw/cxgb4/device.c > @@ -1467,10 +1467,9 @@ static void recover_queues(struct uld_ctx *ctx) > idr_for_each(&ctx->dev->qpidr, count_qps, &count); > > qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC); > - if (!qp_list.qps) { > - spin_unlock_irq(&ctx->dev->lock); > - return; > - } > + if (!qp_list.qps) > + goto unlock; > + > qp_list.idx = 0; > > /* add and ref each qp so it doesn't get freed */ > @@ -1488,6 +1487,7 @@ static void recover_queues(struct uld_ctx *ctx) > spin_lock_irq(&ctx->dev->lock); > WARN_ON(ctx->dev->db_state != RECOVERY); > ctx->dev->db_state = STOPPED; > +unlock: > spin_unlock_irq(&ctx->dev->lock); > } > > This patch is rather pointless IMHO. Using goto labels only brings benefits if you have more than one code path jumping to them this one just confuses the readers. Byte, Johannes -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850