From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0065C433EF for ; Fri, 25 Feb 2022 10:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238587AbiBYKxu (ORCPT ); Fri, 25 Feb 2022 05:53:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239853AbiBYKxt (ORCPT ); Fri, 25 Feb 2022 05:53:49 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A62C1B5115 for ; Fri, 25 Feb 2022 02:53:16 -0800 (PST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K4mmx328FzdfgZ; Fri, 25 Feb 2022 18:52:01 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Feb 2022 18:53:14 +0800 Received: from [10.40.238.78] (10.40.238.78) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Feb 2022 18:53:14 +0800 Subject: Re: [PATCH for-next 7/8] RDMA/hns: Refactor the alloc_srqc() To: Leon Romanovsky References: <20220218110519.37375-1-liangwenpeng@huawei.com> <20220218110519.37375-8-liangwenpeng@huawei.com> CC: , , From: Wenpeng Liang Message-ID: <97995b94-27ce-9d5b-d438-35f0bc433b18@huawei.com> Date: Fri, 25 Feb 2022 18:53:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.40.238.78] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On 2022/2/24 21:35, Leon Romanovsky wrote: >> +static int hns_roce_create_srqc(struct hns_roce_dev *hr_dev, >> + struct hns_roce_srq *srq) >> +{ >> + struct ib_device *ibdev = &hr_dev->ib_dev; >> + struct hns_roce_cmd_mailbox *mailbox; >> + int ret; >> >> mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); >> if (IS_ERR_OR_NULL(mailbox)) { > hns_roce_alloc_cmd_mailbox() never returns NULL, so the check should be IS_ERR() > > Thanks > There are a few more hns_roce_alloc_cmd_mailbox() return values to deal with. I will add a new patch in v2. Thanks, Wenpeng >> ibdev_err(ibdev, "failed to alloc mailbox for SRQC.\n"); >> - ret = -ENOMEM; >> - goto err_xa; >> + return PTR_ERR(mailbox); >> }