> -----Original Message-----
> From: Matan Azrad [mailto:ma...@mellanox.com]
> Sent: Tuesday, March 31, 2020 6:54 PM
> To: wangyunjian <wangyunj...@huawei.com>; dev@dpdk.org
> Cc: Shahaf Shuler <shah...@mellanox.com>; Slava Ovsiienko
> <viachesl...@mellanox.com>; Lilijun (Jerry) <jerry.lili...@huawei.com>;
> xudingke <xudin...@huawei.com>
> Subject: RE: [dpdk-dev] [PATCH] net/mlx5: remove unnecessary NULL check
>
>
>
> From: wangyunjian
> > From: Yunjian Wang <wangyunj...@huawei.com>
> >
> > This NULL check is unnecessary, container_of is never NULL.
> >
> > Signed-off-by: Yunjian Wang <wangyunj...@huawei.com>
> > ---
> > 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 = container_of(pos, struct mlx5_flow_tbl_data_entry,
> > entry);
> > - MLX5_ASSERT(tbl_data);
>
> So, maybe the assert should be on entry?
Now the 'pos' is being NULL checked.
Thanks
Yunjian
>
> > 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 = 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 = 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
> >