common/mlx5: fix uninitialized RoCE variable
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 22 Apr 2020 22:31:30 +0000 (15:31 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 5 May 2020 13:54:26 +0000 (15:54 +0200)
commitcececca0990926769906f93b044c3d956edd0b8f
tree5c8339c2e52774a08765fcfe1157cffbcaeb3f7c
parent9b080425e31297199dcbfa35d95d287d729c68a0
common/mlx5: fix uninitialized RoCE variable

Gcc 8.3.0 (Debian 10) complains about uninitialized variable.

[474/2122] Compiling C object
'drivers/a715181@@tmp_rte_common_mlx5@sta/common_mlx5_mlx5_nl.c.o'.
In file included from ../drivers/common/mlx5/mlx5_nl.h:12,
                 from ../drivers/common/mlx5/mlx5_nl.c:23:
../drivers/common/mlx5/mlx5_nl.c: In function ‘mlx5_nl_enable_roce_get’:
../drivers/common/mlx5/mlx5_common.h:68:2: warning: ‘cur_en’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  rte_log(RTE_LOG_ ## level, \
  ^~~~~~~
../drivers/common/mlx5/mlx5_nl.c:1560:6: note: ‘cur_en’ was declared here
  int cur_en;
      ^~~~~~

The compiler is correct, this variable would only be set if kernel
netlink response message contains the DEVLINK parameter that flags if
ROCE is enabled.

Fixes: fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/common/mlx5/mlx5_nl.c