Received: by 10.223.176.5 with SMTP id f5csp917912wra; Sat, 27 Jan 2018 12:18:39 -0800 (PST) X-Google-Smtp-Source: AH8x224Xd7LipXGb+gkFFeeSnOxaXYJUQcmygiEkx8/Z7mR61LZhASjjdi6e0Ft9xdC66zG7JLE9 X-Received: by 2002:a17:902:b7c3:: with SMTP id v3-v6mr7950252plz.307.1517084319176; Sat, 27 Jan 2018 12:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517084319; cv=none; d=google.com; s=arc-20160816; b=EtSOOo3j/DJSrxh6a+Twxyn2XNTXZmx9fzZf9bEkJYAcOD7bnEPPbWllaWo9KyZwpM Nl61zLL1HvN2yEJQv4KyyetHi8J6q3ijTyulp1LP68mWuK4TrGEPD9G3QGCVNg5Ssq3n VGrRc9nTYU/6pe3/NB449L4B/aspRrfRG/Q03kTmsmWplpUYvkJd5CxlvJY399Cz2NTz DNUhxFuiifvGTne1vzF/lpTkxmNR0cXNkBR1MdSx5PPlTZzWsm5JfqqkiCHct+BJGiRA fDGVdIASAaHGt7rlA85acWLl47ocztm8j/LYj6//gxCQr7otEu0za9w+6ETzfvBMlARj eFWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=ScVAknUV+BB/RHuNxnmEEGvMbbgke80tyQcan9BXtcI=; b=cLwqPGB3Z2XDyizqDaEbAQ91E10rUZ/tblMKhefydGg3WSXLgsPzZUCMBlEaNpJNTn wIiDDR/y//ctp6wsVCUk+8DyGIYHZBTMoZyAuNWz77aIwuNHt+c7A2VgTMjYC43zk4IH huvnF7faK06/Z2M/DoOA1djKVuJqK5fijJuWAPqN/vFUhpErZtmm13e1OprzCmm0jLv/ kZ8HQ04JG/mlNtXtwtgsromIrbmCbzgXP5BF4kMqKCDY17UuQpqzpbUYlIT604y3SRhB JFXZF9KwemrC0SlYjFFJUOcyByT+PRa4yzgcD+YlStOm+CIR0BokAGuP+HxlbcBejtkq BUwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si5690892plo.628.2018.01.27.12.18.24; Sat, 27 Jan 2018 12:18:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752861AbeA0USA (ORCPT + 99 others); Sat, 27 Jan 2018 15:18:00 -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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.16.1