Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3618704pxk; Mon, 7 Sep 2020 20:06:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1KBBjtsWbikwIYb1YxLxiLae7JQk0w3VrlDKy2mkUyzLPNNKtSodKahG8VxESqZGkJpyW X-Received: by 2002:aa7:d558:: with SMTP id u24mr24821761edr.336.1599534408616; Mon, 07 Sep 2020 20:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599534408; cv=none; d=google.com; s=arc-20160816; b=W2pgkihp3ZXTQExKgsDJVO4G6J3rYEIwC2bd4CdmeU3+UJYZ0MwLYTWhn/oMpcsurj 0hOB05Qg1BNutmmxa7TO/gxtQKa5DA8WmourPsq2KRvBVDoY+00Kl2sVSESQ4fMHgqht GLgStJd6sAsbFO5kx0UZL31NnPrE5hznGsgYP++gKy9dEFjREpmlGSmPzO1aPZohQz2u Nsv+6fV/Sii32pqJQak1d8jX4q59sQkYAWAb0CKVANYHLNrFP6lORZEjQK9UIHrzOk2M WyHZNkuZN/4wsKm7g74iwLZ4Co3nwT3DLjQWYrCvayfErt+anqR+leLOKZO79+Lhao6r RnWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=M+Ed9KZiXyqJ43xPBE/2eEmiLcgyKhs13AeINGmaLXA=; b=f4dKMuaurO1wsimh8gBzJuI4MQJjSJJHoq3MHhQbLIqPKKpOrptoYnxKY+feFTj4G5 VvmUrfgBtq9HJUTYv6cK+EJLE4egw8j4+nXiSLvjgphqld7eIcj8ua5IprIMZVkA4D7e rUxYh/cBXMOfAyHeKEykzT3F1r3ATw6hMDjUtI5OxGFM3JlQXyL4NBCEOSqBvvhy3mx/ 5kmjIrkfoaYDjyIOyn2CJPTcEA9Zd+H2T+kzI6ldWlAnli07KJ1AvOdCbgPGPGJjUZs2 I5f6nr+YWI83daD8J01K+40X5EnAYje3e022kPC3Dk8kzg/mDDVYeSpuQwskw8TYVFFs R6Yw== 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 x23si7603677ejj.642.2020.09.07.20.06.26; Mon, 07 Sep 2020 20:06:48 -0700 (PDT) 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 S1728659AbgIHDC7 (ORCPT + 99 others); Mon, 7 Sep 2020 23:02:59 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:47866 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728411AbgIHDCa (ORCPT ); Mon, 7 Sep 2020 23:02:30 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C73517F4414749013AF6; Tue, 8 Sep 2020 11:02:27 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Tue, 8 Sep 2020 11:02:19 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan Subject: [PATCH net-next 1/7] net: hns3: narrow two local variable range in hclgevf_reset_prepare_wait() Date: Tue, 8 Sep 2020 10:59:48 +0800 Message-ID: <1599533994-32744-2-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599533994-32744-1-git-send-email-tanhuazhong@huawei.com> References: <1599533994-32744-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since variable send_msg and ret only used in if branch, so move their definition into the if branch. Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index e972138..20dd04c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1788,10 +1788,10 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) { #define HCLGEVF_RESET_SYNC_TIME 100 - struct hclge_vf_to_pf_msg send_msg; - int ret = 0; - if (hdev->reset_type == HNAE3_VF_FUNC_RESET) { + struct hclge_vf_to_pf_msg send_msg; + int ret; + hclgevf_build_send_msg(&send_msg, HCLGE_MBX_RESET, 0); ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0); if (ret) { @@ -1806,10 +1806,10 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) /* inform hardware that preparatory work is done */ msleep(HCLGEVF_RESET_SYNC_TIME); hclgevf_reset_handshake(hdev, true); - dev_info(&hdev->pdev->dev, "prepare reset(%d) wait done, ret:%d\n", - hdev->reset_type, ret); + dev_info(&hdev->pdev->dev, "prepare reset(%d) wait done\n", + hdev->reset_type); - return ret; + return 0; } static void hclgevf_dump_rst_info(struct hclgevf_dev *hdev) -- 2.7.4