From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D930FA0352; Tue, 25 Jan 2022 01:49:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58CC44120A; Tue, 25 Jan 2022 01:49:05 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 09EE441186 for ; Tue, 25 Jan 2022 01:49:04 +0100 (CET) Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JjSn10NgnzZfFg; Tue, 25 Jan 2022 08:45:09 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.21; Tue, 25 Jan 2022 08:49:01 +0800 Subject: Re: [PATCH v2 50/83] net/hns3: remove unnecessary NULL checks To: Stephen Hemminger , CC: Yisen Zhuang , Lijun Ou References: <20220124000518.319850-1-stephen@networkplumber.org> <20220124174719.14417-1-stephen@networkplumber.org> <20220124174719.14417-51-stephen@networkplumber.org> From: "Min Hu (Connor)" Message-ID: <6fcbdf35-5d82-c562-4d66-1dd2b8d18687@huawei.com> Date: Tue, 25 Jan 2022 08:49:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20220124174719.14417-51-stephen@networkplumber.org> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Acked-by: Min Hu (Connor) ÔÚ 2022/1/25 1:46, Stephen Hemminger дµÀ: > Remove redundant NULL pointer checks before free functions > found by nullfree.cocci > > Signed-off-by: Stephen Hemminger > --- > drivers/net/hns3/hns3_rxtx.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c > index d240e36e6a86..8a428f88f48e 100644 > --- a/drivers/net/hns3/hns3_rxtx.c > +++ b/drivers/net/hns3/hns3_rxtx.c > @@ -86,8 +86,7 @@ hns3_rx_queue_release(void *queue) > hns3_rx_queue_release_mbufs(rxq); > if (rxq->mz) > rte_memzone_free(rxq->mz); > - if (rxq->sw_ring) > - rte_free(rxq->sw_ring); > + rte_free(rxq->sw_ring); > rte_free(rxq); > } > } > @@ -100,10 +99,8 @@ hns3_tx_queue_release(void *queue) > hns3_tx_queue_release_mbufs(txq); > if (txq->mz) > rte_memzone_free(txq->mz); > - if (txq->sw_ring) > - rte_free(txq->sw_ring); > - if (txq->free) > - rte_free(txq->free); > + rte_free(txq->sw_ring); > + rte_free(txq->free); > rte_free(txq); > } > } >