Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp731562imm; Thu, 13 Sep 2018 06:59:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZHIib4Hb8q/TKV9VrAFtNSgG2hFJ8KfqFyKDVLBABGLNOxQDqXNtOFdATs8PdvrptJqlNO X-Received: by 2002:a17:902:8f8c:: with SMTP id z12-v6mr7459435plo.4.1536847150226; Thu, 13 Sep 2018 06:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847150; cv=none; d=google.com; s=arc-20160816; b=uMsY/pC7p4GYcc9jsotOtbWJn12O1bJkuejFzLrDXe2LhG2YLcVFBpQD0rs/3dV0O7 /fziFlsajLxEsWFaR+X6cYytNBl/3Fa65QSqdLPZ8otKj2rPoicaj32QyuiXZ1LY58qP D4Ln54y+Funfz0w/0OfemGjsAw0hIV90b7kVIpG96MTUoEN9hQqqp0qZ5Qxmo3mo4OJg j40vspL2cwQ8h9fqFgB8ki5BibtLhDf86cAGI4nEmkGf4z9c5Vn4J6IukrX7EWueY4C2 7Fej2HxOAukra6ubq+R0WTwvX123nmmWjCEVRYwComjkiikkeymwIdxEZlr/ix29h2sJ 9aeg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=H+OKaKaxIckVvAef+zGmRQiVivr0Nx7X9Hre5ydw9po=; b=ejPxWN0rYUolckw9FWXil8ZoneBE90y0nczzJYBDeh0KG9+nIyJii27tFv3n8MS9Lz i9H1gCzEzJku2FisJQ844BMO7XEqJV/JHkhGcmOfKmDu+qvSJwn1vCmXCiFovNlN8rfd 019f8UAvFJ/vUnv/O2+Zyx8o1GtHuXEEjWJtF4mMTfz5MZ+n10EebkNQCjd4piQ8j23/ lqL4/bwkJwqWPDxr40jE1ubhlhW0/7LrN1jkK6N2PAgQ3pO5NXm2plce706EzWDskwy4 wV08LFe6wp58/nBRLC/+gjU+2PeUVTduaEUBICA5q7QiFJg7zw5NvPUSqlCJXLQzWO52 uE4Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16-v6si4123190pff.13.2018.09.13.06.58.54; Thu, 13 Sep 2018 06:59:10 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731600AbeIMTIZ (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34706 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbeIMTIY (ORCPT ); Thu, 13 Sep 2018 15:08:24 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7D7DED19; Thu, 13 Sep 2018 13:58:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Lijun Ou , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.18 078/197] RDMA/hns: Fix usage of bitmap allocation functions return values Date: Thu, 13 Sep 2018 15:30:27 +0200 Message-Id: <20180913131844.647700657@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gal Pressman [ Upstream commit a1ceeca679dccc492235f0f629d9e9f7b3d51ca8 ] hns bitmap allocation functions return 0 on success and -1 on failure. Callers of these functions wrongly used their return value as an errno, fix that by making a proper conversion. Fixes: a598c6f4c5a8 ("IB/hns: Simplify function of pd alloc and qp alloc") Signed-off-by: Gal Pressman Acked-by: Lijun Ou Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/hns/hns_roce_pd.c | 2 +- drivers/infiniband/hw/hns/hns_roce_qp.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) --- a/drivers/infiniband/hw/hns/hns_roce_pd.c +++ b/drivers/infiniband/hw/hns/hns_roce_pd.c @@ -37,7 +37,7 @@ static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn) { - return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn); + return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn) ? -ENOMEM : 0; } static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn) --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -115,7 +115,10 @@ static int hns_roce_reserve_range_qp(str { struct hns_roce_qp_table *qp_table = &hr_dev->qp_table; - return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base); + return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, + base) ? + -ENOMEM : + 0; } enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state)