net/mlx5: DR, Fix uninitialized var warning

[ Upstream commit 52f7cf70eb8fac6111786c59ae9dfc5cf2bee710 ]

Smatch warns this:

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c:81
 mlx5dr_table_set_miss_action() error: uninitialized symbol 'ret'.

Initializing ret with -EOPNOTSUPP and fix missing action case.

Fixes: 7838e17253 ("net/mlx5: DR, Expose steering table functionality")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
YueHaibing 2022-11-10 21:47:07 +08:00 committed by Greg Kroah-Hartman
parent ea5844f946
commit 2f6fd2de72

View File

@ -9,7 +9,7 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
struct mlx5dr_matcher *last_matcher = NULL; struct mlx5dr_matcher *last_matcher = NULL;
struct mlx5dr_htbl_connect_info info; struct mlx5dr_htbl_connect_info info;
struct mlx5dr_ste_htbl *last_htbl; struct mlx5dr_ste_htbl *last_htbl;
int ret; int ret = -EOPNOTSUPP;
if (action && action->action_type != DR_ACTION_TYP_FT) if (action && action->action_type != DR_ACTION_TYP_FT)
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -68,6 +68,9 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
} }
} }
if (ret)
goto out;
/* Release old action */ /* Release old action */
if (tbl->miss_action) if (tbl->miss_action)
refcount_dec(&tbl->miss_action->refcount); refcount_dec(&tbl->miss_action->refcount);