mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 17:45:11 +07:00
net/mlx5e: Return the allocated flow directly from __mlx5e_add_fdb_flow
This confusing construction confuses the compiler which can't see that flow is initialized if !err: drivers/net/ethernet/mellanox/mlx5/core/en_tc.c: In function `mlx5e_configure_flower` drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:2727:28: warning: `flow` may be used uninitialized in this function [-Wmaybe-uninitialized] There is no reason for two function outputs, just return the pointer directly and use ERR_PTR to encode a failure. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
149e566fef
commit
71129676ab
@ -2767,14 +2767,13 @@ mlx5e_alloc_flow(struct mlx5e_priv *priv, int attr_size,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
static struct mlx5e_tc_flow *
|
||||
__mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
|
||||
struct tc_cls_flower_offload *f,
|
||||
u16 flow_flags,
|
||||
struct net_device *filter_dev,
|
||||
struct mlx5_eswitch_rep *in_rep,
|
||||
struct mlx5_core_dev *in_mdev,
|
||||
struct mlx5e_tc_flow **__flow)
|
||||
struct mlx5_core_dev *in_mdev)
|
||||
{
|
||||
struct netlink_ext_ack *extack = f->common.extack;
|
||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||
@ -2814,15 +2813,13 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
|
||||
if (err)
|
||||
goto err_free;
|
||||
|
||||
*__flow = flow;
|
||||
|
||||
return 0;
|
||||
return flow;
|
||||
|
||||
err_free:
|
||||
kfree(flow);
|
||||
kvfree(parse_attr);
|
||||
out:
|
||||
return err;
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static int mlx5e_tc_add_fdb_peer_flow(struct tc_cls_flower_offload *f,
|
||||
@ -2855,11 +2852,13 @@ static int mlx5e_tc_add_fdb_peer_flow(struct tc_cls_flower_offload *f,
|
||||
in_mdev = priv->mdev;
|
||||
|
||||
parse_attr = flow->esw_attr->parse_attr;
|
||||
err = __mlx5e_add_fdb_flow(peer_priv, f, flow->flags,
|
||||
parse_attr->filter_dev,
|
||||
flow->esw_attr->in_rep, in_mdev, &peer_flow);
|
||||
if (err)
|
||||
peer_flow = __mlx5e_add_fdb_flow(peer_priv, f, flow->flags,
|
||||
parse_attr->filter_dev,
|
||||
flow->esw_attr->in_rep, in_mdev);
|
||||
if (IS_ERR(peer_flow)) {
|
||||
err = PTR_ERR(peer_flow);
|
||||
goto out;
|
||||
}
|
||||
|
||||
flow->peer_flow = peer_flow;
|
||||
flow->flags |= MLX5E_TC_FLOW_DUP;
|
||||
@ -2885,10 +2884,10 @@ mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
|
||||
struct mlx5e_tc_flow *flow;
|
||||
int err;
|
||||
|
||||
err = __mlx5e_add_fdb_flow(priv, f, flow_flags, filter_dev, in_rep,
|
||||
in_mdev, &flow);
|
||||
if (err)
|
||||
goto out;
|
||||
flow = __mlx5e_add_fdb_flow(priv, f, flow_flags, filter_dev, in_rep,
|
||||
in_mdev);
|
||||
if (IS_ERR(flow))
|
||||
return PTR_ERR(flow);
|
||||
|
||||
if (is_peer_flow_needed(flow)) {
|
||||
err = mlx5e_tc_add_fdb_peer_flow(f, flow);
|
||||
|
Loading…
Reference in New Issue
Block a user