net: hns3: narrow two local variable range in hclgevf_reset_prepare_wait()
authorHuazhong Tan <tanhuazhong@huawei.com>
Tue, 8 Sep 2020 02:59:48 +0000 (10:59 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Sep 2020 02:51:40 +0000 (19:51 -0700)
Since variable send_msg and ret only used in if branch, so move
their definition into the if branch.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index e972138..20dd04c 100644 (file)
@@ -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)