From: "lipeng (Y)" <lipeng321@huawei.com>
To: Colin King <colin.king@canonical.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Salil Mehta <salil.mehta@huawei.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Huazhong Tan <tanhuazhong@huawei.com>, <netdev@vger.kernel.org>
Cc: <kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] net: hns3: Fix uninitialized return from function
Date: Thu, 18 Feb 2021 10:14:44 +0800 [thread overview]
Message-ID: <9e7cba23-14af-9359-a00e-7b08d7f5c748@huawei.com> (raw)
In-Reply-To: <20210210152644.137770-1-colin.king@canonical.com>
在 2021/2/10 23:26, Colin King 写道:
> From: Colin Ian King <colin.king@canonical.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@canonical.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,
prev parent reply other threads:[~2021-02-18 2:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 15:26 [PATCH][next] net: hns3: Fix uninitialized return from function Colin King
2021-02-10 21:44 ` kernel test robot
2021-02-18 2:14 ` lipeng (Y) [this message]
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=9e7cba23-14af-9359-a00e-7b08d7f5c748@huawei.com \
--to=lipeng321@huawei.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@huawei.com \
--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).