Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932368AbdCIL41 (ORCPT ); Thu, 9 Mar 2017 06:56:27 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:29837 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754440AbdCILz0 (ORCPT ); Thu, 9 Mar 2017 06:55:26 -0500 Date: Thu, 9 Mar 2017 13:55:03 +0200 From: Yuval Shaia To: SF Markus Elfring Cc: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd() Message-ID: <20170309115502.GG3307@yuval-lap> References: <3954cbe9-a265-bcb8-2dac-daade1a5e967@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3954cbe9-a265-bcb8-2dac-daade1a5e967@users.sourceforge.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1836 Lines: 58 On Wed, Mar 08, 2017 at 02:30:18PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 8 Mar 2017 11:11:35 +0100 > > This issue was detected by using the Coccinelle software. > > 1. Return directly if a call of the function "_ocrdma_alloc_pd" failed. > > 2. Reduce the scope for the local variable "status" to one case > of an if statement. > > 3. Delete the jump label "err" then. > > 4. Return zero as a constant at the end. > > Signed-off-by: Markus Elfring > --- > drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c > index ae0d343d1731..d3cb8e2f099f 100644 > --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c > +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c > @@ -484,19 +484,17 @@ static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev *dev, > struct ocrdma_ucontext *uctx, > struct ib_udata *udata) > { > - int status = 0; > - > uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata); > if (IS_ERR(uctx->cntxt_pd)) { > - status = PTR_ERR(uctx->cntxt_pd); > + int status = PTR_ERR(uctx->cntxt_pd); > + > uctx->cntxt_pd = NULL; > - goto err; > + return status; > } > > uctx->cntxt_pd->uctx = uctx; > uctx->cntxt_pd->ibpd.device = &dev->ibdev; > -err: > - return status; > + return 0; > } Reviewed-by: Yuval Shaia > > static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx) > -- > 2.12.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html