Skip to content

Commit abeffce

Browse files
arndbdavem330
authored andcommitted
net/mlx5e: Fix a -Wmaybe-uninitialized warning
As found by Olof's build bot, we gain a harmless warning about a potential uninitialized variable reference in mlx5: drivers/net/ethernet/mellanox/mlx5/core/en_tc.c: In function 'parse_tc_fdb_actions': drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:769:13: warning: 'out_dev' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:811:21: note: 'out_dev' was declared here This was introduced through the addition of an 'IS_ERR/PTR_ERR' pair that gcc is unfortunately unable to completely figure out. The problem being gcc cannot tell that if(IS_ERR()) in mlx5e_route_lookup_ipv4() is equivalent to checking if(err) later, so it assumes that 'out_dev' is used after the 'return PTR_ERR(rt)'. The PTR_ERR_OR_ZERO() case by comparison is fairly easy to detect by gcc, so it can't get that wrong, so it no longer warns. Hadar Hen Zion already attempted to fix the warning earlier by adding fake initializations, but that ended up not fully addressing all warnings, so I'm reverting it now that it is no longer needed. Link: http://arm-soc.lixom.net/buildlogs/mainline/v4.10-rc3-98-gcff3b2c/ Fixes: a42485e ("net/mlx5e: TC ipv4 tunnel encap offload error flow fixes") Fixes: a757d10 ("net/mlx5e: Fix kbuild warnings for uninitialized parameters") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a367e7 commit abeffce

File tree

1 file changed

+7
-4
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+7
-4
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,12 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
668668
int ttl;
669669

670670
#if IS_ENABLED(CONFIG_INET)
671+
int ret;
672+
671673
rt = ip_route_output_key(dev_net(mirred_dev), fl4);
672-
if (IS_ERR(rt))
673-
return PTR_ERR(rt);
674+
ret = PTR_ERR_OR_ZERO(rt);
675+
if (ret)
676+
return ret;
674677
#else
675678
return -EOPNOTSUPP;
676679
#endif
@@ -741,8 +744,8 @@ static int mlx5e_create_encap_header_ipv4(struct mlx5e_priv *priv,
741744
struct flowi4 fl4 = {};
742745
char *encap_header;
743746
int encap_size;
744-
__be32 saddr = 0;
745-
int ttl = 0;
747+
__be32 saddr;
748+
int ttl;
746749
int err;
747750

748751
encap_header = kzalloc(max_encap_size, GFP_KERNEL);

0 commit comments

Comments
 (0)