Skip to content

Commit

Permalink
net/mlx5: DR, Fix uninitialized var warning
Browse files Browse the repository at this point in the history
[ Upstream commit 52f7cf7 ]

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: 7838e17 ("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>
  • Loading branch information
YueHaibing authored and gregkh committed Dec 8, 2022
1 parent b46f614 commit 70299a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static int dr_table_set_miss_action_nic(struct mlx5dr_domain *dmn,
int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
struct mlx5dr_action *action)
{
int ret;
int ret = -EOPNOTSUPP;

if (action && action->action_type != DR_ACTION_TYP_FT)
return -EOPNOTSUPP;
Expand All @@ -67,6 +67,9 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
goto out;
}

if (ret)
goto out;

/* Release old action */
if (tbl->miss_action)
refcount_dec(&tbl->miss_action->refcount);
Expand Down

0 comments on commit 70299a7

Please sign in to comment.