From patchwork Thu Jan 18 15:17:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 10173585 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 58EFD60230 for ; Thu, 18 Jan 2018 15:18:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AA40282EC for ; Thu, 18 Jan 2018 15:18:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EFDA2833E; Thu, 18 Jan 2018 15:18:06 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 B0097282EC for ; Thu, 18 Jan 2018 15:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932483AbeARPSE (ORCPT ); Thu, 18 Jan 2018 10:18:04 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33227 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932124AbeARPSD (ORCPT ); Thu, 18 Jan 2018 10:18:03 -0500 Received: by mail-qt0-f195.google.com with SMTP id e2so31010342qti.0 for ; Thu, 18 Jan 2018 07:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=DmM1h2IUwSk4umBycKGjoDTJ0rOSeTojnCfzr560AI0=; b=glgFhrYRUpKSzbOdX4MBh+O3aCqwVHUf/cA5rxMgdOMzVavnGpSa2JKTDrDPbQnu+N cJJ1vTtC8uGVjhdvFH/ZVoefa9YIXnhSj0vTWLlFrkMNNYEFfU+TWac8c1jzNoKz/RiG Ne3Zb3/be6lXjh6fbxspkrVCcOywSDE/BTt5I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DmM1h2IUwSk4umBycKGjoDTJ0rOSeTojnCfzr560AI0=; b=ZYQHBpd3G+Gr4DqG2yuE7HTANCPuOpxiSIk8BcwOxHjHmdULOxwMIUdAMxIaS5t2tT sxohrdtxR8a3zgFF9qc7CfpJeMF/EZg8xZQMC9Q6gplkjEMeyg8MW+y77or2fFmYUo+I SIB4BvbpnUE9Oo4GSMC1/DToHlmgyIWrBsA57z61d+LRkw6Im7CtD8jM/6MwCbS+Az3l bkQRP4bmMFoSx4NnmBqPtNim28A74nq0mF2+48bXlOctWUc8zNFu9RNzdfQMIM2ijIS7 BSs7W27BH8xb6QVZjYPeqjCOCBvBTXS6MNpCXPRgat1NSnmLTqm1gVFch9pjUAauDWcT qulw== X-Gm-Message-State: AKwxytdmkO8oRWm10H+tpq0CilbxVo9qJr6wTOv34tNWXTcWj/83F1AF 6b5oAq9+r8zFr5yTOPGCB5APRg== X-Google-Smtp-Source: ACJfBotAc9dddK8Vd9KSRRRJNVPmKdTTyEpNHzdLtaBUTaK9wlDksGI/w3NGs9JscpPlaG7ocN9HPw== X-Received: by 10.55.97.2 with SMTP id v2mr15197569qkb.266.1516288683125; Thu, 18 Jan 2018 07:18:03 -0800 (PST) Received: from neo00-el73.dhcp.broadcom.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id d42sm805972qta.87.2018.01.18.07.18.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 07:18:02 -0800 (PST) From: Devesh Sharma To: dledford@redhat.com, jgg@mellanox.com Cc: linux-rdma@vger.kernel.org, Devesh Sharma Subject: [PATCH wip/dl-for-next] RDMA/bnxt_re: Fix kbuild error Date: Thu, 18 Jan 2018 10:17:45 -0500 Message-Id: <1516288665-11055-1-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 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 Fix for following build failure drivers/infiniband/hw/bnxt_re/ib_verbs.c:3402:7-14: ERROR: reference preceded by free on line 3375 tree: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git wip/dl-for-next head: d47f6fe6736ed3ecb39cd69fe26e3518f199eecd commit: cb8a852e09c1dc8e47af741714063acf9c4d115c [3/28] RDMA/bnxt_re: Add support for MRs with Huge pages :::::: branch date: 4 hours ago :::::: commit date: 15 hours ago >> drivers/infiniband/hw/bnxt_re/ib_verbs.c:3402:7-14: ERROR: reference preceded by free on line 3375 git remote add rdma-rdma https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git git remote update rdma-rdma git checkout cb8a852e09c1dc8e47af741714063acf9c4d115c vim +3402 drivers/infiniband/hw/bnxt_re/ib_verbs.c Signed-off-by: Devesh Sharma Reviewed-by: Yuval Shaia --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 7220322..9b8fa77 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3355,10 +3355,8 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr) int rc; rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); - if (rc) { + if (rc) dev_err(rdev_to_dev(rdev), "Dereg MR failed: %#x\n", rc); - return rc; - } if (mr->pages) { rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res, @@ -3421,7 +3419,7 @@ struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type type, rc = bnxt_qplib_alloc_mrw(&rdev->qplib_res, &mr->qplib_mr); if (rc) - goto fail; + goto bail; mr->ib_mr.lkey = mr->qplib_mr.lkey; mr->ib_mr.rkey = mr->ib_mr.lkey; @@ -3443,9 +3441,10 @@ struct ib_mr *bnxt_re_alloc_mr(struct ib_pd *ib_pd, enum ib_mr_type type, return &mr->ib_mr; fail_mr: - bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); -fail: kfree(mr->pages); +fail: + bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); +bail: kfree(mr); return ERR_PTR(rc); } @@ -3595,22 +3594,20 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length, pbl_tbl = kcalloc(umem_pgs, sizeof(u64 *), GFP_KERNEL); if (!pbl_tbl) { rc = -ENOMEM; - goto free_mrw; + goto free_umem; } page_shift = umem->page_shift; if (!bnxt_re_page_size_ok(page_shift)) { dev_err(rdev_to_dev(rdev), "umem page size unsupported!"); - kfree(pbl_tbl); rc = -EFAULT; - goto free_umem; + goto fail; } if (!umem->hugetlb && length > BNXT_RE_MAX_MR_SIZE_LOW) { dev_err(rdev_to_dev(rdev), "Requested MR Sz:%llu Max sup:%llu", length, (u64)BNXT_RE_MAX_MR_SIZE_LOW); - kfree(pbl_tbl); rc = -EINVAL; goto fail; }