From patchwork Wed Mar 8 13:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9611145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22D696046A for ; Wed, 8 Mar 2017 13:38:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BADB32856E for ; Wed, 8 Mar 2017 13:38:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF95828585; Wed, 8 Mar 2017 13:38:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60D402856E for ; Wed, 8 Mar 2017 13:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752818AbdCHNhp (ORCPT ); Wed, 8 Mar 2017 08:37:45 -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 Received: from [192.168.1.2] ([92.228.144.238]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MBkal-1cwMEV0HBv-00AqHZ; Wed, 08 Mar 2017 14:30:20 +0100 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: 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-By: Devesh Sharma Reviewed-by: Yuval Shaia --- 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)