From patchwork Sat Apr 22 14:54: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: 9694439 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 41EDF60383 for ; Sat, 22 Apr 2017 14:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 406BC28304 for ; Sat, 22 Apr 2017 14:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 339DC285E4; Sat, 22 Apr 2017 14:58:01 +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 D811128304 for ; Sat, 22 Apr 2017 14:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424890AbdDVO4L (ORCPT ); Sat, 22 Apr 2017 10:56:11 -0400 Received: from mout.web.de ([212.227.15.3]:50522 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424894AbdDVOyk (ORCPT ); Sat, 22 Apr 2017 10:54:40 -0400 Received: from [192.168.1.2] ([77.181.100.232]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MIBu2-1d0HCm1Vde-003r7f; Sat, 22 Apr 2017 16:54:26 +0200 Subject: [PATCH v2 12/12] IB/ocrdma: One jump label less in ocrdma_alloc_ucontext_pd() From: SF Markus Elfring To: Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier , Yuval Shaia , linux-rdma@vger.kernel.org Cc: LKML , kernel-janitors@vger.kernel.org References: <1492720999.3041.18.camel@redhat.com> <86425035-7da8-d2b1-8544-d4f7540d50c6@users.sourceforge.net> Message-ID: Date: Sat, 22 Apr 2017 16:54:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <86425035-7da8-d2b1-8544-d4f7540d50c6@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:U1MkOxxLVXnkS4xmC+pWHxuZKCCSuj834vilX3TFBKwz9vyHli+ 0i+UXGezUE0vdo3q+QHwd44xpNRTCD4inTk+seLPZ1e5DrYoizv6OMR8LeHEDSFHiIc1ZQj IobnJ6i4Wpa74VD9acLRHtoo1XbJywohuUqu5TzEm480Fr/lazoS1kJMQLsZjPCvfV2DLMt 6aIK8IEDBLeTu+uRMXunQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:M0sz7+V89RI=:8Sm9tR8H9dLFWK3YGNzrhz VotncKDNh4faa5hprfPyGvhMryp7AbMMGtYIMP38bGQSD456T5sKv06eAfnchhFmzh0w0Es2s wChU+E0mCxapzhePKp0mrWsZ0fzXG3FH/sxwr7rMCxLx1+W7dLxg6DJeDiQqQMNTNJ5fjh32K JsVZ6GUFYtQcSmNKWvT0oSgBzisq+Ku3vK8WmHJvwN92XTFKXhtnc+XdMyDGR6IUT9pw8m4RF 6pZ9EUamXr7lknX6xYkYXGbIPoUVpCUvqAAr6Zwv7SCbugnnMnI2eOEa9a+lXs487WETbupqg /y/dCvL5rsFOFgd8SFb/dPiucfz7Y8q3kVhIvVBQUg6eWc2SAaHPwsDd9oGymSdoui1+0tdmI IhKv4fvXvA/XUbFOabql7XT289jR09Y2h0xa6lxmSxelIKIj4e/IefxXqmxj/h70usj7gp8s0 HHJ2IjtHHkLsjkO34/sUI98v3C3jSv1W3woFKJpRt/AKOqQh592XIfuFbz0EeYAf33LqAq5Zy YtooGIAy7BMx+DMjxLBQnNUHq0Sj09GhzsHiIxLdjm225LuCNKFNBxDN8dkEU6NOFLAWym3sb 6mWuxWUq4wahfHsmgaffAjd0xtaR9DG+KT7QBgwkZdFld5KOxQWV0HGeZF4C9SUGAff3yXq68 QhxWrtwetOQ8Q/uSL18XCDe0pwR10eTfmI+Lmj55Wqlx403QrkJTCrVXXt5T0qtAGjOzxmQYt 0432ofxQHhkLOC9aSM/6+bMmgsJbz7MFZbQKTX9XUjCVr8tMLKxYTqZte8NV0PIKsOyOTV9Vu gih+6Af 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: Sat, 22 Apr 2017 15:45:21 +0200 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 712c0dc9c980..fbceb9d9d5b0 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)