Skip to content

Commit

Permalink
net/hns3: fix build warning
Browse files Browse the repository at this point in the history
[ upstream commit 60fe5c3cfc3c28952448d2163c4eb1d22d86ccac ]

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

[1]
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: 6430855 ("net/hns3: fix link status when port is stopped")

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Dongdong Liu <liudongdong3@huawei.com>
  • Loading branch information
jerinjacobk authored and bluca committed Jun 14, 2023
1 parent 154506b commit 4397ebd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/hns3/hns3_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2701,6 +2701,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
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;
Expand All @@ -2716,7 +2717,6 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
hns3_err(hw, "failed to get port link info, ret = %d.", ret);
}

memset(&new_link, 0, sizeof(new_link));
hns3_setup_linkstatus(eth_dev, &new_link);

out:
Expand Down

0 comments on commit 4397ebd

Please sign in to comment.