DPDK patches and discussions
 help / color / mirror / Atom feed
From: <jerinj@marvell.com>
To: <dev@dpdk.org>, Dongdong Liu <liudongdong3@huawei.com>,
	Yisen Zhuang <yisen.zhuang@huawei.com>,
	Huisong Li <lihuisong@huawei.com>,
	"Min Hu (Connor)" <humin29@huawei.com>
Cc: <thomas@monjalon.net>, <david.marchand@redhat.com>,
	<ferruh.yigit@amd.com>, <andrew.rybchenko@oktetlabs.ru>,
	Jerin Jacob <jerinj@marvell.com>, <stable@dpdk.org>
Subject: [PATCH] net/hns3: fix build warning
Date: Tue, 4 Apr 2023 12:25:25 +0530	[thread overview]
Message-ID: <20230404065525.3313249-1-jerinj@marvell.com> (raw)

From: Jerin Jacob <jerinj@marvell.com>

aarch64 gcc 12.2.0 build complain with below warning[1].
Move the new_link initialization upwards to fix the warning.

Compiling C object drivers/libtmp_rte_net_hns3.a.p/net_hns3_hns3_ethdev.c.o
drivers/net/hns3/hns3_ethdev.c: In function ‘hns3_dev_link_update’:
drivers/net/hns3/hns3_ethdev.c:2249:1: warning: ‘new_link’ may be
used uninitialized [-Wmaybe-uninitialized]

Fixes: 64308555d5bf ("net/hns3: fix link status when port is stopped")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 drivers/net/hns3/hns3_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 36896f8989..a872cb8dd7 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2257,6 +2257,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	struct rte_eth_link new_link;
 	int ret;
 
+	memset(&new_link, 0, sizeof(new_link));
 	/* When port is stopped, report link down. */
 	if (eth_dev->data->dev_started == 0) {
 		new_link.link_autoneg = mac->link_autoneg;
@@ -2280,7 +2281,6 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 		rte_delay_ms(HNS3_LINK_CHECK_INTERVAL);
 	} while (retry_cnt--);
 
-	memset(&new_link, 0, sizeof(new_link));
 	hns3_setup_linkstatus(eth_dev, &new_link);
 
 out:
-- 
2.40.0


             reply	other threads:[~2023-04-04  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  6:55 jerinj [this message]
2023-04-04  8:22 ` Dongdong Liu
2023-04-07 17:08   ` Ferruh Yigit

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=20230404065525.3313249-1-jerinj@marvell.com \
    --to=jerinj@marvell.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=humin29@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=liudongdong3@huawei.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yisen.zhuang@huawei.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).