From patchwork Sat Jan 27 20:17:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10187639 X-Patchwork-Delegate: jgg@ziepe.ca 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 7E14260388 for ; Sat, 27 Jan 2018 20:18:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71B8A28BDD for ; Sat, 27 Jan 2018 20:18:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6494528BE0; Sat, 27 Jan 2018 20:18: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 10AE328BDD for ; Sat, 27 Jan 2018 20:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752590AbeA0UR7 (ORCPT ); Sat, 27 Jan 2018 15:17:59 -0500 Received: from mout.web.de ([212.227.17.12]:58700 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752248AbeA0UR6 (ORCPT ); Sat, 27 Jan 2018 15:17:58 -0500 Received: from [192.168.1.2] ([78.49.117.84]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MeBPe-1ePTo61YWU-00PszH; Sat, 27 Jan 2018 21:17:52 +0100 Subject: [PATCH 2/2] RDMA/bnxt_re: Use common error handling code in bnxt_qplib_alloc_dpi_tbl() From: SF Markus Elfring To: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Jason Gunthorpe , Selvin Xavier , Somnath Kotur , Sriharsha Basavapatna Cc: LKML , kernel-janitors@vger.kernel.org, Himanshu Jha References: <19c755a6-8c52-bbd5-a425-48fc08cecd4f@users.sourceforge.net> Message-ID: <30f2eb91-16c6-6c13-343d-64c5f42f2497@users.sourceforge.net> Date: Sat, 27 Jan 2018 21:17:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <19c755a6-8c52-bbd5-a425-48fc08cecd4f@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:jwR9ORXjUfNvWYXt9w2O3QMoEVsyxTCRr/01yzCauCNng0wEN+s SInTJnIW0G1MxMpcUR+HjLHvm71l8vUDU4ARLe8w8ii3diCW75t/tvR+UGV8rTTQwINE8rT s/3tfF7QRajdz2Io8CtAuPXBeX5QgYLo8mrm+UXQQblU0CyXmQpZI4XYyf2AMXldhO41sUI 8jLK/o8fwCE3rMsocwFSA== X-UI-Out-Filterresults: notjunk:1; V01:K0:xDmHklmKcZw=:/kvuLagwtjzL9TbHDkj0jI R+FEsDdgh4Sp4m2Rl4yeV0F39XpDZBP4zPhUxWfPlctfCY4N9a5Mi6qddqHAraBSdgnXYhwpq Ww/mFfAgkJWgDY5YOmiWsnBduocOm8Yx9WDkWb+ikmMJe0gzq3pYbaacMiUn3w+WdyLLmbKE1 nPiC1rup9L48ZxCgcBNI6yXupYtkdmU67KhtrLsGRj3i5NJUtiJ7UeqQ/Tl1ggJDWHVHxyKJ6 jivBYWox7cUsDBSrwZws7fsARi8iopsumwFBt95Ri4BbuEa6JxF5cS5iQlhwCizple6Fd2stb zNSY6SJikvKh9Z8nsEVkPg9nwuryq42ISiC1VnETFVA+GrkMAYco0UOMgDoVcYPJJisze4SEP SzfJ2j4/0JiVxisqJiwd0IgJIeF4DqGAD5oqFSTv+0xoJs7x5nQ3GlMxi197AiIKLGjg2F55G ddwOsq+hZJVM53cnRGylCYVUFytk9Dn216u9sL3YpvbaILv5Dzm5tRqc5a+r3/xk6zakL3yzJ 9NMoJpOiz7Ip6SUkQNGkPliBz/dtepDkxxECGR3C1V1tC4cOpg+7VUk4NFCSJGU8jTik3xhyU rECUhDm4OFjNOb25FvM5SDLlRtVBOedVplU/jMXILDfhksw3SK6gsq8glJZzpKdPk3K/2bScy R+ON8DB9dc/ff2jogGoV16JR6aqrveSlHoXA37/a0lbDbdkC4oW7plWlsB62A+9AGzYCSD0au Da1S7LhAFbKOdj+nrKO8zK0ZexHYFTxzsf8OcdW6o8erf5hjoqLmNF2SAKcnfbwX3BH+o6L4h w6NDuy6PDDIgFuXU8Rln4qaTbos3YYOoWOYP0xAFq7P9yLfKZc= 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, 27 Jan 2018 20:56:56 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/bnxt_re/qplib_res.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index 9dacfd24869b..539a5d44e6db 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c @@ -705,10 +705,8 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, dpit->max = dbr_len / PAGE_SIZE; dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL); - if (!dpit->app_tbl) { - pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem); - return -ENOMEM; - } + if (!dpit->app_tbl) + goto unmap_io; bytes = dpit->max >> 3; if (!bytes) @@ -716,15 +714,18 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, dpit->tbl = kmalloc(bytes, GFP_KERNEL); if (!dpit->tbl) { - pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem); kfree(dpit->app_tbl); dpit->app_tbl = NULL; - return -ENOMEM; + goto unmap_io; } memset((u8 *)dpit->tbl, 0xFF, bytes); return 0; + +unmap_io: + pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem); + return -ENOMEM; } /* PKEYs */