Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp102722pxt; Wed, 4 Aug 2021 06:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7HqUNxK9mymbA0OmK+L91Bt9iUCvJ/e4A8b6aSbQiVSOuC77DiTD1ne9H9VWyx3ggTLc+ X-Received: by 2002:a17:906:2497:: with SMTP id e23mr26044403ejb.194.1628085431564; Wed, 04 Aug 2021 06:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628085431; cv=none; d=google.com; s=arc-20160816; b=j6lkcGTiVfefIP5eL+KcdlqK2nLQUj1xQytLHAsiXG/7K0YuHy5Oz+Lyoh/bL/MKMs EgKK0qKth9CQ5kCYvgeV2ARG7HB0aTGt1rt4pGJ4UX7az46tF/AXFyOKEeYw/dytJ5ys 6pUpTkqpCyikFjJPcuC4X8hP/G8pgImKOQtMfkxx5xw58283a4do3HbNMclY9AjtZiWt l1pBY0b2etgmqTUMEqCPJrgQwyhYD3xSqe83317tC8oujq+ySVaFWsyGfmM5XfsJtWRN FU2i72CJvSMzC7xK6XddEnQ1mSIp0dTJlmjEmLp11UOg7g7EIcA8EPKl6W0Bl4yA3IFL 8D3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7RZC8VQrf8XcSJeiZ5ohnOZoM/UnS9HFUC0uD13QiDg=; b=ADniDciG8AfQ9jQ2CAtURtuIKBihUyKsGdG3TEDIxocgSsCOVEHo3p4ETVKNTb2OCE U4/7JRfqqkDHorjgFM6wEzFfCwVLgXKyXimjBOLqfzbtA7wOoPri9GeWApj6wlLuh66x zgJWwplNfpS+XCpsDTFvZKtCcgw0aM3vT7HPpCpqgUSWDSO4zCB9w7Ld7qAnX8s4DgVb 1uBkCpeI+adOiLFbuY8DQ1i3BcH41K2G6ZFqs13QeyhKxLdehefpDZ92TuPtdp96gzpz ytbFOQHJlZSIjjuW7uyOh2glbL42JhruzEQmgYXqA70z0CANAwd6DjdWJyC8HfJ8JtK4 HDVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="r/CW58Ru"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si2326945ejr.642.2021.08.04.06.56.47; Wed, 04 Aug 2021 06:57:11 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="r/CW58Ru"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238267AbhHDNxk (ORCPT + 99 others); Wed, 4 Aug 2021 09:53:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:47640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237156AbhHDNxj (ORCPT ); Wed, 4 Aug 2021 09:53:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6FBFB60EE5; Wed, 4 Aug 2021 13:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628085207; bh=9OFLSLaWZEiz0zjbwf/0fkoZwlWio885LGnwee/LxW8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r/CW58RuFXGwzx9U720u7bhqr8lspy7Zqwn2Ag0dvEQLdTlpflBX6F75MT8lXVuqg 8AvLMAOKcS9QF3JJiJxsb91vZlxydcURGKFfuDksLB4e8nDWquV5PKvqv0NHnHy8Xq IUD/9zjARklfA+8g+JMLsZctg6VtvoQaIX/KUD1ieYxkvePlFoLvtIeIhy9TeLTgm0 ATYHGZEgrpSWSCtpn8sQwZoyPJH0O6OXDEN1dcecY+OWo+JHkbBCwg+cYaiul77tdp zPKqYI4S2VI7XvGDzsXUj+ERfgVEW7rv1zRV/ArU3cH3RSqfKWv5cqcfhphYXZx/bU ycn5PVT0T43wA== Date: Wed, 4 Aug 2021 16:53:21 +0300 From: Leon Romanovsky To: YueHaibing Cc: liangwenpeng@huawei.com, liweihang@huawei.com, dledford@redhat.com, jgg@ziepe.ca, chenglang@huawei.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] RDMA/hns: Fix return in hns_roce_rereg_user_mr() Message-ID: References: <20210804125939.20516-1-yuehaibing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210804125939.20516-1-yuehaibing@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 04, 2021 at 08:59:39PM +0800, YueHaibing wrote: > 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; > } I don't understand this function, it returns or ERR_PTR() or NULL, but should return &mr->ibmr in success path. How does it work? Thanks > > int hns_roce_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) > -- > 2.17.1 >