[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9e7cba23-14af-9359-a00e-7b08d7f5c748@huawei.com>
Date: Thu, 18 Feb 2021 10:14:44 +0800
From: "lipeng (Y)" <lipeng321@...wei.com>
To: Colin King <colin.king@...onical.com>,
Yisen Zhuang <yisen.zhuang@...wei.com>,
Salil Mehta <salil.mehta@...wei.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Huazhong Tan <tanhuazhong@...wei.com>, <netdev@...r.kernel.org>
CC: <kernel-janitors@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] net: hns3: Fix uninitialized return from function
在 2021/2/10 23:26, Colin King 写道:
> From: Colin Ian King <colin.king@...onical.com>
>
> Currently function hns3_reset_notify_uninit_enet is returning
> the contents of the uninitialized variable ret. Fix this by
> removing ret (since it is no longer used) and replace it with
> a return of the literal value 0.
you can not remove "ret" this way.
try to change "int hns3_uninit_all_ring" to "void
hns3_uninit_all_ring" and fix related code is better.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: 64749c9c38a9 ("net: hns3: remove redundant return value of hns3_uninit_all_ring()")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> index 9565b7999426..bf4302a5cf95 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> @@ -4640,7 +4640,6 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
> {
> struct net_device *netdev = handle->kinfo.netdev;
> struct hns3_nic_priv *priv = netdev_priv(netdev);
> - int ret;
>
> if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
> netdev_warn(netdev, "already uninitialized\n");
> @@ -4662,7 +4661,7 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
>
> hns3_put_ring_config(priv);
>
> - return ret;
> + return 0;
> }
>
> static int hns3_reset_notify(struct hnae3_handle *handle,
Powered by blists - more mailing lists