From patchwork Wed Feb 8 21:15:17 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: 9563427 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 F2FAA601C3 for ; Wed, 8 Feb 2017 21:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70BDB284F3 for ; Wed, 8 Feb 2017 21:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64B4D284F9; Wed, 8 Feb 2017 21:16:00 +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 0A328284F3 for ; Wed, 8 Feb 2017 21:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751108AbdBHVP6 (ORCPT ); Wed, 8 Feb 2017 16:15:58 -0500 Received: from mout.web.de ([212.227.15.3]:60547 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbdBHVP5 (ORCPT ); Wed, 8 Feb 2017 16:15:57 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M8iei-1cjIoE1Ezs-00CDh5; Wed, 08 Feb 2017 22:15:18 +0100 Subject: [PATCH 05/14] RDMA/cxgb4: Return an error code only as a constant in ep_open() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Wed, 8 Feb 2017 22:15:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> X-Provags-ID: V03:K0:iYYqePcdgMo3Nccuas6VBAhapJmokcPvoFJk6JuF4p68VLH6wyh suIk67Zaevtlr6DmZsRY0U9UDTBI1SxcmFXa5+Xv5h7OSKYOcyNWIAaIzSKLXKkf7H1/AYX bSCo5MVlebwFsBqKt1lGJmBvbV0WMk/WN1I9aglMhVE/1q6aZ3rWwJx3QS2uArpyJ4u+4vg 0jmQ01yhr3CmfenO1WbDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:vYGE9sw5Q0A=:+WrSF4JaImH0e2gB77rV3Y 22NTrx6m5jshvniX2yIzxOO7/h9dlSGbV+4aTh/V8HoJVileKZKL9Ymkglo9qpfsedOObNC7L YeFWaajZVUGObjhSBg4XA2B4+B2EJ7M1AKcbsbJH4n/hneiUoJgZ5z5wuq91kNrrrb6JPbEP1 lsa6ce4df5csWwzBFPKmVV4JxsW9qUzzS9KBXdW54wLyBmkI1O2yTqAdOvpU5I7YjpGJhsRiw pEJ/VPLNiV3+L/jgvCx2tY4gF1t6rndwBrUbg5V8TqeKMgCQhD+/B+eFCKg/+tFgvf4nYhgnR nmjV/9cHDqPuGHVh//LbkAmwoqZMejvpVtlVPdm5MYj+Yp6GDuei5nI4ScISjP0c0AjYySItj 0tamnFfEBWyTWI2akkfkE2OwDQWs8XeMJj/upKazAIEyv2ftJnaUWopyJXlDPbn5YVndVQaKH FqzVlde0clMk3E5bzDV4RVKMn7RsttjBRYzwLad4jEQ1NjGZdg7J5mm1R8E+QO4EDeMEPUJAR 8E84Qdr9GZRT3iOSr3IhPBuiJALk51yd94N36Txf2J9GCCBpJq5W7V59KEf39RvyWitSArPwU LHDcNXQ0191OXafSPB/5PlqHuGZxiKdAtWEpbe4fc6ibgESquTm6hg9y7S3Z+rl9rILrFNUK0 cPmx8D3MjegimP0eCZ/HVtgIYiLCbehaogi8OuDMoXT57rTe2iGfDEosibpZwDQqibCmBRoT5 qZ99rmQwYmc32gcIW7l1NoAwJ4lR46nm1X0Aoqw7NRKGGeQIyEJElwXqOml/oZq+XfNFu5oiP K1m9kfl 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 Feb 2017 16:36:31 +0100 * Return an error code without storing it in an intermediate variable. * Adjust jump targets according to the Linux coding style convention. * Delete the local variable "ret" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb4/device.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 46410c4a9afb..51801a7d4fb3 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -679,14 +679,12 @@ static int ep_release(struct inode *inode, struct file *file) static int ep_open(struct inode *inode, struct file *file) { struct c4iw_debugfs_data *epd; - int ret = 0; int count = 1; epd = kmalloc(sizeof(*epd), GFP_KERNEL); - if (!epd) { - ret = -ENOMEM; - goto out; - } + if (!epd) + goto failure_indication; + epd->devp = inode->i_private; epd->pos = 0; @@ -698,10 +696,8 @@ static int ep_open(struct inode *inode, struct file *file) epd->bufsize = count * 240; epd->buf = vmalloc(epd->bufsize); - if (!epd->buf) { - ret = -ENOMEM; - goto err1; - } + if (!epd->buf) + goto free_epd; spin_lock_irq(&epd->devp->lock); idr_for_each(&epd->devp->hwtid_idr, dump_ep, epd); @@ -710,11 +706,11 @@ static int ep_open(struct inode *inode, struct file *file) spin_unlock_irq(&epd->devp->lock); file->private_data = epd; - goto out; -err1: + return 0; +free_epd: kfree(epd); -out: - return ret; +failure_indication: + return -ENOMEM; } static const struct file_operations ep_debugfs_fops = {