Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753338AbdCHNhs (ORCPT ); Wed, 8 Mar 2017 08:37:48 -0500 Received: from mout.web.de ([212.227.15.14]:53706 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799AbdCHNho (ORCPT ); Wed, 8 Mar 2017 08:37:44 -0500 Subject: [PATCH 24/26] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd() To: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <3954cbe9-a265-bcb8-2dac-daade1a5e967@users.sourceforge.net> Date: Wed, 8 Mar 2017 14:30:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:W8P9d6kh9OvSATStOyeXxrczqwBq2POmEM/YIxvC1N2M/RN2yXH U9pxvQP8eJZNwhmd/74EJmqYp3mFbIWeMpRV57f29zH6b4NUXXxieJmBhqRnJEmzHFuXFRg GM3JTfBmNXLLINI4UIPUzdP1N6hvamZsdFefqnD725/nfHYTjOVMkcJhx+KOFl0wvWS9ZNn 2B6ICYI0G7Ue1aqtGO/aw== X-UI-Out-Filterresults: notjunk:1;V01:K0:LER0XEKoTEU=:3iJa87LpKpdHuVGEKvDaDT 8ppGdoSGGIUFa0lj6dgXXEEapDnoX4KCeDypB/ZifF1I+ul8AHpDJZaeo8CImpKoixrzSVIFv 9ZfEArTWx4CfLhdhZTb5t3kMuELwiHO2v5m+tRYeTkz053anjclMTRHPQNaTC137sKFwoE/30 r4Phre3Rxiekfq3r5Mk0FT1xgePAeA+SW9/sbNcInTHmklHCgETSwjLTahhtLv7ivF9CiyzFu /wzZYhtawUwcbwyIKN51HO/dgCC8ljdmxe5tGz4pb+pP7Ic8EcjvWCAkDA6N9HXzKbCYhE7g/ Ox3jEAmmpUUP4I9/c4qSFwjlE1z6xsjoR4Dr8y+Bx8L8uQWweku8WZyTacD4Qi69JrkyC4lD6 SH0wgTh6dFTIk0OGIncggXkAkKcaBnJ2ytQB37iF6+jVDybDHjywG33e6I11MVmqb5Xpi4XLT STkBcefOeqLt6IppxzxrMJ/5spDPj+HdtVYjTFGBENVrOX+5WhPDIHT/3zHhI62tM5fAMer/W t2dBarAHwPC9QIAGmcMdhUlQg4WL4+bI76T7ZC8OAYo5Ul6P3uo6Y4xEYZMs80QrUGam/Mmex 5ctH8TEJ7whxIK5usJwTIu3dJyn+qBIkAItpjOmD7MOa9cfTavx05HwKraehHDKPIBdmexRo+ mv53DLI+XqJ4D0s0nyQXw6gEGdgOlkbmCtFrl/XCVs6qpfEimpfMIw/+9wMDDcEV6GF7Ztg5x Je3yWRHW0tfWaYeDeTRe+EvGU/m9+HDI/9CBV8W40GZ3R1/qzJuwm+lXx3+SHPvV+4dD0mkak Q0XtX/u Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1414 Lines: 49 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; } static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx) -- 2.12.0