net: hns3: modify redundant initialization of variable
authorGuojia Liao <liaoguojia@huawei.com>
Fri, 16 Aug 2019 08:09:38 +0000 (16:09 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Aug 2019 19:59:12 +0000 (12:59 -0700)
Some temporary variables do not need to be initialized that
they will be set before used, so this patch deletes the
initialization value of these temporary variables.

Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huzhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hnae3.c
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index 908d4f45c06a528c11f7b78586fa4404f18b054e..6bbba15bcfd800e333bce48a60f64083a963d979 100644 (file)
@@ -104,7 +104,6 @@ int hnae3_register_client(struct hnae3_client *client)
 {
        struct hnae3_client *client_tmp;
        struct hnae3_ae_dev *ae_dev;
-       int ret = 0;
 
        if (!client)
                return -ENODEV;
@@ -123,7 +122,7 @@ int hnae3_register_client(struct hnae3_client *client)
                /* if the client could not be initialized on current port, for
                 * any error reasons, move on to next available port
                 */
-               ret = hnae3_init_client_instance(client, ae_dev);
+               int ret = hnae3_init_client_instance(client, ae_dev);
                if (ret)
                        dev_err(&ae_dev->pdev->dev,
                                "match and instantiation failed for port, ret = %d\n",
@@ -164,7 +163,7 @@ void hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo)
        const struct pci_device_id *id;
        struct hnae3_ae_dev *ae_dev;
        struct hnae3_client *client;
-       int ret = 0;
+       int ret;
 
        if (!ae_algo)
                return;
@@ -258,7 +257,7 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev)
        const struct pci_device_id *id;
        struct hnae3_ae_algo *ae_algo;
        struct hnae3_client *client;
-       int ret = 0;
+       int ret;
 
        if (!ae_dev)
                return -ENODEV;
index 677bfe069fb7410df0b8431f7dc25518d91309e3..42606538bb012ec609323785167cb512a1785016 100644 (file)
@@ -749,7 +749,7 @@ static int hns3_set_link_ksettings(struct net_device *netdev,
 {
        struct hnae3_handle *handle = hns3_get_handle(netdev);
        const struct hnae3_ae_ops *ops = handle->ae_algo->ops;
-       int ret = 0;
+       int ret;
 
        /* Chip don't support this mode. */
        if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF)
index 05a4cdbf903af723e780180515811f364039ccf7..5ce9a8ac627d9559a65ba65dde15fd0258ecc9b8 100644 (file)
@@ -1557,8 +1557,8 @@ int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en)
 
 static void hclge_handle_rocee_ras_error(struct hnae3_ae_dev *ae_dev)
 {
-       enum hnae3_reset_type reset_type = HNAE3_NONE_RESET;
        struct hclge_dev *hdev = ae_dev->priv;
+       enum hnae3_reset_type reset_type;
 
        if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) ||
            hdev->pdev->revision < 0x21)
index f30d1126d378c9bc25dbd2ff8d830bf423473446..e829101d576c035d7b83245d529ad8bf2830dc7c 100644 (file)
@@ -404,8 +404,8 @@ static int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev)
 {
        struct hclge_port_shapping_cmd *shap_cfg_cmd;
        struct hclge_desc desc;
-       u32 shapping_para = 0;
        u8 ir_u, ir_b, ir_s;
+       u32 shapping_para;
        int ret;
 
        ret = hclge_shaper_para_calc(hdev->hw.mac.speed,
index 55d3c784f2d4e9fbbab3769d93adc360bff1a797..4c2c9458648fabe9a6b0cd5cda3eaac7044bc15a 100644 (file)
@@ -43,7 +43,7 @@ static int hclgevf_cmd_csq_clean(struct hclgevf_hw *hw)
 {
        struct hclgevf_dev *hdev = container_of(hw, struct hclgevf_dev, hw);
        struct hclgevf_cmq_ring *csq = &hw->cmq.csq;
-       int clean = 0;
+       int clean;
        u32 head;
 
        head = hclgevf_read_dev(hw, HCLGEVF_NIC_CSQ_HEAD_REG);
index defc90595a4b7f633c9195dcbd152273ac964187..594cae8c7410bdb22910905aa8d38c3cfb20e205 100644 (file)
@@ -2302,7 +2302,7 @@ static void hclgevf_uninit_msi(struct hclgevf_dev *hdev)
 
 static int hclgevf_misc_irq_init(struct hclgevf_dev *hdev)
 {
-       int ret = 0;
+       int ret;
 
        hclgevf_get_misc_vector(hdev);