DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, matan@mellanox.com
Subject: [dpdk-dev] [PATCH] common/mlx5: fix uninitialized variable warning
Date: Wed, 22 Apr 2020 15:28:34 -0700	[thread overview]
Message-ID: <20200422222834.16480-1-stephen@networkplumber.org> (raw)

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: matan@mellanox.com
---
 drivers/common/mlx5/mlx5_nl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_nl.c b/drivers/common/mlx5/mlx5_nl.c
index 847e78dbcea6..c6014c3ee0b3 100644
--- a/drivers/common/mlx5/mlx5_nl.c
+++ b/drivers/common/mlx5/mlx5_nl.c
@@ -1557,7 +1557,7 @@ mlx5_nl_enable_roce_get(int nlsk_fd, int family_id, const char *pci_addr,
 	struct genlmsghdr *genl;
 	uint32_t sn = MLX5_NL_SN_GENERATE;
 	int ret;
-	int cur_en;
+	int cur_en = 0;
 	uint8_t buf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
 		    NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
 		    NLMSG_ALIGN(sizeof(struct nlattr)) * 4 +
-- 
2.20.1


                 reply	other threads:[~2020-04-22 22:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422222834.16480-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).