From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3ECC6A058A; Wed, 1 Apr 2020 13:13:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 839C91BE9B; Wed, 1 Apr 2020 13:13:47 +0200 (CEST) Received: from huawei.com (szxga01-in.huawei.com [45.249.212.187]) by dpdk.org (Postfix) with ESMTP id 9815D1BE95 for ; Wed, 1 Apr 2020 13:13:45 +0200 (CEST) Received: from DGGEMM402-HUB.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id F27A26C5F1E7076E20B2; Wed, 1 Apr 2020 19:13:38 +0800 (CST) Received: from DGGEMM424-HUB.china.huawei.com (10.1.198.41) by DGGEMM402-HUB.china.huawei.com (10.3.20.210) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 1 Apr 2020 19:13:38 +0800 Received: from DGGEMM513-MBX.china.huawei.com ([169.254.1.52]) by dggemm424-hub.china.huawei.com ([10.1.198.41]) with mapi id 14.03.0487.000; Wed, 1 Apr 2020 19:13:32 +0800 From: wangyunjian To: Matan Azrad , "dev@dpdk.org" CC: Shahaf Shuler , Slava Ovsiienko , "Lilijun (Jerry)" , xudingke Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: remove unnecessary NULL check Thread-Index: AQHWB0aVT8AXGgYzoESqNy/PZrl+fqhiAKsAgAIdpYA= Date: Wed, 1 Apr 2020 11:13:31 +0000 Message-ID: <34EFBCA9F01B0748BEB6B629CE643AE60CF3AC08@dggemm513-mbx.china.huawei.com> References: <1585650269-11556-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.173.251.152] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH] net/mlx5: remove unnecessary NULL check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Matan Azrad [mailto:matan@mellanox.com] > Sent: Tuesday, March 31, 2020 6:54 PM > To: wangyunjian ; dev@dpdk.org > Cc: Shahaf Shuler ; Slava Ovsiienko > ; Lilijun (Jerry) ; > xudingke > Subject: RE: [dpdk-dev] [PATCH] net/mlx5: remove unnecessary NULL check >=20 >=20 >=20 > From: wangyunjian > > From: Yunjian Wang > > > > This NULL check is unnecessary, container_of is never NULL. > > > > Signed-off-by: Yunjian Wang > > --- > > drivers/net/mlx5/mlx5.c | 3 --- > > 1 file changed, 3 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > > 94aaa6057..2e4edb123 100644 > > --- a/drivers/net/mlx5/mlx5.c > > +++ b/drivers/net/mlx5/mlx5.c > > @@ -747,7 +747,6 @@ mlx5_free_table_hash_list(struct mlx5_priv *priv) > > if (pos) { > > tbl_data =3D container_of(pos, struct mlx5_flow_tbl_data_entry, > > entry); > > - MLX5_ASSERT(tbl_data); >=20 > So, maybe the assert should be on entry? Now the 'pos' is being NULL checked. Thanks Yunjian >=20 > > mlx5_hlist_remove(sh->flow_tbls, pos); > > rte_free(tbl_data); > > } > > @@ -756,7 +755,6 @@ mlx5_free_table_hash_list(struct mlx5_priv *priv) > > if (pos) { > > tbl_data =3D container_of(pos, struct mlx5_flow_tbl_data_entry, > > entry); > > - MLX5_ASSERT(tbl_data); > > mlx5_hlist_remove(sh->flow_tbls, pos); > > rte_free(tbl_data); > > } > > @@ -766,7 +764,6 @@ mlx5_free_table_hash_list(struct mlx5_priv *priv) > > if (pos) { > > tbl_data =3D container_of(pos, struct mlx5_flow_tbl_data_entry, > > entry); > > - MLX5_ASSERT(tbl_data); > > mlx5_hlist_remove(sh->flow_tbls, pos); > > rte_free(tbl_data); > > } > > -- > > 2.19.1 > >