Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp85598pxt; Wed, 4 Aug 2021 06:31:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRhLTLWsbjeI8CbrCNk36Y9ejhsLul/YKsMzbTzvJxIXX159NzquCPP7w0fEO6XmG/kK/m X-Received: by 2002:a92:d848:: with SMTP id h8mr2312443ilq.282.1628083891664; Wed, 04 Aug 2021 06:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628083891; cv=none; d=google.com; s=arc-20160816; b=keLMv3VPzfEQ5b5wQiYzcYRNAwxNMChHEc6dHgl5pwd6XYgF18zRESJt0RHQJqNy8W 1LScBxcIGvLDDK0TPlrvf4Zerjjt44Qopw9RXZqFxiBtFJreUk9MVVl5cmaQCEQ6WVQE T5fGcX/pm+YSX2XX8gC/bN/lb5+shITe31deuMqL2Sj2MLLAegMEi+A8vVAq0qcHrBa2 W1mt3lzhMwYeNtT1MrjFhZoeHkvAsktqe/GOojIsT3SqdREsPOxHGnNsNI4gmNqPOEur 3iUhXJ5Ranew/lpkpp+nrs139Cik8wRmDZ5LXDaU/RCjdiFQz/MfuBd5kDUNCtowGRQf CTaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=+ZUG7VOdh/D6jdBdLtRTfTJLffrxypeCYntDXli339A=; b=qTVX2gMeQLqIL+JRrjyyaMJ4utX3r+tsbplNXgJHYcJadyfHBFyZiorg8hloCelg0g Awxk7aOS/GxiBUwakGfK5lTqUSQBupWLZ5B203fJNx9lZUr/xSA+lhxuYh3cNGq6WkOl 7f+dT5ugfD8sXnP8/0TmvrMBDBfUE2j+uUWwFQBujJaceCaNM34am/gc+9Jj57jRMQ/0 VcN0QEihY4iPCkFAcKdeiHzHAi7gJpC+VszqW1rSAJ+3Dx+wAggQXdND5Vz/44Evx5Yl S0S1S8Ibr0YcU/MKR0ZJw71S47Scl2VYJtvXTU8ik0YV7QQX68qKa4yuuD/rrq5dcImn mvzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si2295741ilk.49.2021.08.04.06.31.15; Wed, 04 Aug 2021 06:31:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237817AbhHDNAB (ORCPT + 99 others); Wed, 4 Aug 2021 09:00:01 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:12445 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236532AbhHDNAB (ORCPT ); Wed, 4 Aug 2021 09:00:01 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GfsDr2dv3zckpk; Wed, 4 Aug 2021 20:56:12 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 4 Aug 2021 20:59:46 +0800 Received: from localhost (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 4 Aug 2021 20:59:45 +0800 From: YueHaibing To: , , , , CC: , , YueHaibing Subject: [PATCH -next] RDMA/hns: Fix return in hns_roce_rereg_user_mr() Date: Wed, 4 Aug 2021 20:59:39 +0800 Message-ID: <20210804125939.20516-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If re-registering an MR in hns_roce_rereg_user_mr(), we should return NULL instead of pass 0 to ERR_PTR. Fixes: 4e9fc1dae2a9 ("RDMA/hns: Optimize the MR registration process") Signed-off-by: YueHaibing --- drivers/infiniband/hw/hns/hns_roce_mr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index 006c84bb3f9f..7089ac780291 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -352,7 +352,9 @@ struct ib_mr *hns_roce_rereg_user_mr(struct ib_mr *ibmr, int flags, u64 start, free_cmd_mbox: hns_roce_free_cmd_mailbox(hr_dev, mailbox); - return ERR_PTR(ret); + if (ret) + return ERR_PTR(ret); + return NULL; } int hns_roce_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) -- 2.17.1