Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6926664pxb; Wed, 17 Feb 2021 18:19:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxiTfAvQIB+BlnT0N3CnhuDGw5QMNLscBCFRgKk40YTwyeL9NiAwjX8R7gchU/D5O8iUvRh X-Received: by 2002:a17:907:d21:: with SMTP id gn33mr1821914ejc.242.1613614795083; Wed, 17 Feb 2021 18:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613614795; cv=none; d=google.com; s=arc-20160816; b=MgGShRqvK7Y6yiNDVOPuCBG71YNYDbOddDSZi+3kkDy4ZTBNedplw7jjZ0zIAWrr8E ncWZV6urswoUhy1RIxvZI00xoTS8ajYK3M/xDPLq+QAYBs3GwEhPl8pwcHZ+7f8kE+bP cqwgBSoS7Xg3t28iP0YnuU/P/puLUVg8S+UYvS60K+W4qkvvIXOdibpI1HbFUx+Gphek UGquCHvKnc1faSqWs7Jq89y6CM7uWG2STEoeg2Lba2kjB+OT23HM4A11clIctq5iYjvp 9N1ajxPehxRFhhsxrDo1ARrjYcV8UhVo8+cAMcZbZ1RciD2c9ync/Z+zsmr6PHzmgTgG pA5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=GehbekcoyLh13C0aCaxXGE6KL7yZBKgT1YdBdgpYQ3c=; b=XIfmB0BkRN/mwJclFtaqQrvDR652gkesEOqCKc3tZxvERlJYLKxXkZJWC8i+k8qlK0 pUnKHItRPdh1jDEFpF0nT/rBxriDiCb6udZV0lAu66SG7EopYzQYVRMQ04P8YtusZ/tj 5J12t5+U1JEOuyKaZ2d3d37VRWPuzwdHlsr/dX8w2cNmB1XsAyAt9qFKSeLrkmLEZdVU Px5/Ax/muu5eWi+GtJjNJlWms8iCM+PrvdLei7rKBkSnc/uFs3lBzU7+J2u6suLjxGYs YcM/Iwq74Io6hEUnsRVmZtaOgNE/38Sabmcj2W0fR4yItvIvpSx2d/wnIQhsEk/DK/2I LYUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si2388694edv.27.2021.02.17.18.19.31; Wed, 17 Feb 2021 18:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbhBRCPj (ORCPT + 99 others); Wed, 17 Feb 2021 21:15:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:12550 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhBRCPh (ORCPT ); Wed, 17 Feb 2021 21:15:37 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Dgysl2lZHzMY49; Thu, 18 Feb 2021 10:12:59 +0800 (CST) Received: from [10.67.100.138] (10.67.100.138) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Thu, 18 Feb 2021 10:14:43 +0800 Subject: Re: [PATCH][next] net: hns3: Fix uninitialized return from function To: Colin King , Yisen Zhuang , Salil Mehta , "David S . Miller" , Jakub Kicinski , Huazhong Tan , CC: , References: <20210210152644.137770-1-colin.king@canonical.com> From: "lipeng (Y)" Message-ID: <9e7cba23-14af-9359-a00e-7b08d7f5c748@huawei.com> Date: Thu, 18 Feb 2021 10:14:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20210210152644.137770-1-colin.king@canonical.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.100.138] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/2/10 23:26, Colin King 写道: > From: Colin Ian King > > 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 > --- > 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,