From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61C4C428CD; Tue, 4 Apr 2023 10:22:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECCE1410FA; Tue, 4 Apr 2023 10:22:45 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id EAF9C40EE3; Tue, 4 Apr 2023 10:22:43 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PrLJH3QbCzSknw; Tue, 4 Apr 2023 16:18:55 +0800 (CST) Received: from [10.67.103.235] (10.67.103.235) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 4 Apr 2023 16:22:39 +0800 Subject: Re: [PATCH] net/hns3: fix build warning To: , , Yisen Zhuang , Huisong Li , "Min Hu (Connor)" References: <20230404065525.3313249-1-jerinj@marvell.com> CC: , , , , From: Dongdong Liu Message-ID: <9edb30d6-e4c7-3c72-d95a-e46eb486886b@huawei.com> Date: Tue, 4 Apr 2023 16:22:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20230404065525.3313249-1-jerinj@marvell.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.235] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Jerin Many thanks for fixing the warning. On 2023/4/4 14:55, jerinj@marvell.com wrote: > From: Jerin Jacob > > 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] It looks like a false positive from the logic of the code. Anyway, this warning can be fixed by this patch, so Acked-by: Dongdong Liu Thanks, Dongdong > > Fixes: 64308555d5bf ("net/hns3: fix link status when port is stopped") > Cc: stable@dpdk.org > > Signed-off-by: Jerin Jacob > --- > 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: >