]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5: DR, Fix uninitialized var warning
authorYueHaibing <yuehaibing@huawei.com>
Thu, 10 Nov 2022 13:47:07 +0000 (21:47 +0800)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 24 Nov 2022 08:03:20 +0000 (00:03 -0800)
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: 7838e1725394 ("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>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c

index 31d443dd838622fc9d7dd5ea56483d1bd018ea7b..f68461b1339120e43d5d07a4ef6468aa14135d37 100644 (file)
@@ -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;
@@ -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);