Coverity flags that 'ctx->tunnel' variable is used before
it's checked for NULL. This patch fixes this issue.
Coverity issue: 366201
Fixes:
868d2e342cf3 ("net/mlx5: fix tunnel offload hub multi-thread protection")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
rte_spinlock_unlock(&thub->sl);
ctx->tunnel = mlx5_flow_tunnel_allocate(dev, ctx->app_tunnel);
- ctx->tunnel->refctn = 1;
rte_spinlock_lock(&thub->sl);
- if (ctx->tunnel)
+ if (ctx->tunnel) {
+ ctx->tunnel->refctn = 1;
LIST_INSERT_HEAD(&thub->tunnels, ctx->tunnel, chain);
+ }
}