From patchwork Thu Jan 14 17:38:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 8034731 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11C13BEEE5 for ; Thu, 14 Jan 2016 17:38:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B33F20499 for ; Thu, 14 Jan 2016 17:38:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B1232044B for ; Thu, 14 Jan 2016 17:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755652AbcANRin (ORCPT ); Thu, 14 Jan 2016 12:38:43 -0500 Received: from mout.web.de ([212.227.17.11]:63070 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753931AbcANRil (ORCPT ); Thu, 14 Jan 2016 12:38:41 -0500 Received: from [192.168.1.3] ([77.182.186.104]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MYw1v-1aetVa191P-00ViYR; Thu, 14 Jan 2016 18:38:25 +0100 Subject: [PATCH v3 1/6] InfiniBand-ocrdma: One jump label less in ocrdma_alloc_ucontext_pd() To: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Mitesh Ahuja , Sean Hefty , Selvin Xavier References: <566ABCD9.1060404@users.sourceforge.net> <567EDED5.4040201@users.sourceforge.net> <5697D865.5010507@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <5697DD0D.9030308@users.sourceforge.net> Date: Thu, 14 Jan 2016 18:38:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <5697D865.5010507@users.sourceforge.net> X-Provags-ID: V03:K0:dQrAawEm/TIJOK9iA2R6aA9ETG6n04OwnKVCRhBI+u7hdWinTtw NeRYWAeXDuA+tZ00K99S7TlhPzBP4VS5h9ju9SUsF5PNpzNtfzjq0UvKM+bUHupd51TXd5R PRaC5FVrfzuPWF0S/L1PpxP85OBPvX1d19FymAasHq24IgUhcTQbN6JjC/mJm1FAP9qIsvP Bs882LkJvtmHyt3QFIkWQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:n+ONH/X8xjs=:fS+Phm5kBHn4boVUKAD18o 0evN/KNXKy+xlXOCDjHesj8c81RBFqumg+3EJODGTzdnu8hq0TaqCOp/o5o7SyDrys+Ghft7h huiT2jOXhJ5H0u4g1fjANP3x68Pb9YSgrz0W/LtxmlLhigIOg2dit9Ow7L3qV2JbmTHh5TjLb oYxDr16NrQ+i7XSGbsbn8JA11CMYqKpf8DiwLnFuuVeTztqaAxzNiaEX0+9wBgNkh5QpszAPk BppTe2gHDmmMjrYpFYySYl9+kHk0CZuUuB3r15oEKyHuuTLCQ6gXuysgxSLtvjJOcFh2qD/uA IxyBQ7tU9rTKuicMXY1+Cn+hJi1jABx8Lh/blemrtPWmktCffP0BmECnPK1tIjBqkIfA67HMf RHlcKqLlYuI9a9EbnL8zKHbaOhmTQeoz2uLOflfc9CImiUUud9Lui/xnmUMs74FjCkiosCTAS 4gvuzuOz43RagqFudyPmDAZuxmSD4PilkHAXFc+Sirr2mkTlgl0lmjpAff6ySd0dTnH11VQMZ hnN0xCxbVSOi4tHMa6qzls285cFee9SRpIH8aofF+P1s9kLMQIj/P79kzY7GwuN5M/KVRxSKQ azE4gR4Dj+a7HAnYB+G8SGZ24zk2BuqJrThURNTw9xVDzN3wR4LPgSL0791nEyaiTNnLHk5Q3 VZAPPyYTAO4rU5eutYkfNQlJWO2qBd2QyC3mpSWROen6j1/PL1s+mKOYeWJwwatAA4O4O7uHY Ny0wqpC9V43fpGdMftJ8CxE/sDZEJ3u0NK7gfG4WFB0E/JUMMeXZFYbRayI9wf0OTvYVcRBCX OK7eF0W Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 14 Jan 2016 17:17:44 +0100 This issue was detected by using the Coccinelle software. * Let us return directly if a call of the _ocrdma_alloc_pd() function failed. * Reduce the scope for the local variable "status" to one case of an if statement. * Delete the jump label "err" then. * Return zero as a constant at the end. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index d4c687b..4caf167 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -483,19 +483,16 @@ 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)