Skip to content

Commit 7f8bcd9

Browse files
liuyonglong86davem330
authored andcommitted
net: hns: remove redundant variable initialization
There are some variables in HNS driver will not being referenced before assigned, so there is no need to init them. Signed-off-by: Yonglong Liu <[email protected]> Signed-off-by: Huazhong Tan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a4ec57 commit 7f8bcd9

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static void hns_ae_update_stats(struct hnae_handle *handle,
630630
struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle);
631631
u64 tx_bytes = 0, rx_bytes = 0, tx_packets = 0, rx_packets = 0;
632632
u64 rx_errors = 0, tx_errors = 0, tx_dropped = 0;
633-
u64 rx_missed_errors = 0;
633+
u64 rx_missed_errors;
634634

635635
dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
636636
if (!dsaf_dev)

drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ void hns_mac_get_regs(struct hns_mac_cb *mac_cb, void *data)
12021202

12031203
void hns_set_led_opt(struct hns_mac_cb *mac_cb)
12041204
{
1205-
int nic_data = 0;
1205+
int nic_data;
12061206
int txpkts, rxpkts;
12071207

12081208
txpkts = mac_cb->txpkt_for_led - mac_cb->hw_stats.tx_good_pkts;

drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ int hns_dsaf_set_mac_uc_entry(
16131613
struct dsaf_device *dsaf_dev,
16141614
struct dsaf_drv_mac_single_dest_entry *mac_entry)
16151615
{
1616-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
1616+
u16 entry_index;
16171617
struct dsaf_drv_tbl_tcam_key mac_key;
16181618
struct dsaf_tbl_tcam_ucast_cfg mac_data;
16191619
struct dsaf_drv_priv *priv =
@@ -1679,7 +1679,7 @@ int hns_dsaf_rm_mac_addr(
16791679
struct dsaf_device *dsaf_dev,
16801680
struct dsaf_drv_mac_single_dest_entry *mac_entry)
16811681
{
1682-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
1682+
u16 entry_index;
16831683
struct dsaf_tbl_tcam_ucast_cfg mac_data;
16841684
struct dsaf_drv_tbl_tcam_key mac_key;
16851685

@@ -1751,7 +1751,7 @@ static void hns_dsaf_mc_mask_bit_clear(char *dst, const char *src)
17511751
int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,
17521752
struct dsaf_drv_mac_single_dest_entry *mac_entry)
17531753
{
1754-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
1754+
u16 entry_index;
17551755
struct dsaf_drv_tbl_tcam_key mac_key;
17561756
struct dsaf_drv_tbl_tcam_key mask_key;
17571757
struct dsaf_tbl_tcam_data *pmask_key = NULL;
@@ -1861,7 +1861,7 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,
18611861
int hns_dsaf_del_mac_entry(struct dsaf_device *dsaf_dev, u16 vlan_id,
18621862
u8 in_port_num, u8 *addr)
18631863
{
1864-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
1864+
u16 entry_index;
18651865
struct dsaf_drv_tbl_tcam_key mac_key;
18661866
struct dsaf_drv_priv *priv =
18671867
(struct dsaf_drv_priv *)hns_dsaf_dev_priv(dsaf_dev);
@@ -1910,7 +1910,7 @@ int hns_dsaf_del_mac_entry(struct dsaf_device *dsaf_dev, u16 vlan_id,
19101910
int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev,
19111911
struct dsaf_drv_mac_single_dest_entry *mac_entry)
19121912
{
1913-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
1913+
u16 entry_index;
19141914
struct dsaf_drv_tbl_tcam_key mac_key;
19151915
struct dsaf_drv_priv *priv = hns_dsaf_dev_priv(dsaf_dev);
19161916
struct dsaf_drv_soft_mac_tbl *soft_mac_entry = priv->soft_mac_tbl;
@@ -2264,7 +2264,7 @@ void hns_dsaf_update_stats(struct dsaf_device *dsaf_dev, u32 node_num)
22642264
*/
22652265
void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data)
22662266
{
2267-
u32 i = 0;
2267+
u32 i;
22682268
u32 j;
22692269
u32 *p = data;
22702270
u32 reg_tmp;
@@ -2768,7 +2768,7 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port)
27682768
struct dsaf_drv_mac_single_dest_entry mask_entry;
27692769
struct dsaf_drv_tbl_tcam_key temp_key, mask_key;
27702770
struct dsaf_drv_soft_mac_tbl *soft_mac_entry;
2771-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
2771+
u16 entry_index;
27722772
struct dsaf_drv_tbl_tcam_key mac_key;
27732773
struct hns_mac_cb *mac_cb;
27742774
u8 addr[ETH_ALEN] = {0};
@@ -2870,7 +2870,7 @@ static void set_promisc_tcam_disable(struct dsaf_device *dsaf_dev, u32 port)
28702870
struct dsaf_tbl_tcam_data tbl_tcam_data_uc = {0, 0};
28712871
struct dsaf_tbl_tcam_data tbl_tcam_mask = {0, 0};
28722872
struct dsaf_drv_soft_mac_tbl *soft_mac_entry;
2873-
u16 entry_index = DSAF_INVALID_ENTRY_IDX;
2873+
u16 entry_index;
28742874
struct dsaf_drv_tbl_tcam_key mac_key;
28752875
u8 addr[ETH_ALEN] = {0};
28762876

drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ void hns_rcb_get_common_regs(struct rcb_common_cb *rcb_com, void *data)
974974
bool is_dbg = HNS_DSAF_IS_DEBUG(rcb_com->dsaf_dev);
975975
u32 reg_tmp;
976976
u32 reg_num_tmp;
977-
u32 i = 0;
977+
u32 i;
978978

979979
/*rcb common registers */
980980
regs[0] = dsaf_read_dev(rcb_com, RCB_COM_CFG_ENDIAN_REG);
@@ -1045,7 +1045,7 @@ void hns_rcb_get_ring_regs(struct hnae_queue *queue, void *data)
10451045
u32 *regs = data;
10461046
struct ring_pair_cb *ring_pair
10471047
= container_of(queue, struct ring_pair_cb, q);
1048-
u32 i = 0;
1048+
u32 i;
10491049

10501050
/*rcb ring registers */
10511051
regs[0] = dsaf_read_dev(queue, RCB_RING_RX_RING_BASEADDR_L_REG);

drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static void hns_xgmac_get_link_status(void *mac_drv, u32 *link_stat)
482482
*/
483483
static void hns_xgmac_get_regs(void *mac_drv, void *data)
484484
{
485-
u32 i = 0;
485+
u32 i;
486486
struct mac_driver *drv = (struct mac_driver *)mac_drv;
487487
u32 *regs = data;
488488
u64 qtmp;

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ static int hns_nic_rx_poll_one(struct hns_nic_ring_data *ring_data,
872872
static bool hns_nic_rx_fini_pro(struct hns_nic_ring_data *ring_data)
873873
{
874874
struct hnae_ring *ring = ring_data->ring;
875-
int num = 0;
875+
int num;
876876
bool rx_stopped;
877877

878878
hns_update_rx_rate(ring);
@@ -1881,7 +1881,7 @@ static void hns_nic_set_rx_mode(struct net_device *ndev)
18811881
static void hns_nic_get_stats64(struct net_device *ndev,
18821882
struct rtnl_link_stats64 *stats)
18831883
{
1884-
int idx = 0;
1884+
int idx;
18851885
u64 tx_bytes = 0;
18861886
u64 rx_bytes = 0;
18871887
u64 tx_pkts = 0;

drivers/net/ethernet/hisilicon/hns_mdio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static int hns_mdio_write(struct mii_bus *bus,
279279
static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
280280
{
281281
int ret;
282-
u16 reg_val = 0;
282+
u16 reg_val;
283283
u8 devad = ((regnum >> 16) & 0x1f);
284284
u8 is_c45 = !!(regnum & MII_ADDR_C45);
285285
u16 reg = (u16)(regnum & 0xffff);
@@ -420,7 +420,7 @@ static int hns_mdio_probe(struct platform_device *pdev)
420420
{
421421
struct hns_mdio_device *mdio_dev;
422422
struct mii_bus *new_bus;
423-
int ret = -ENODEV;
423+
int ret;
424424

425425
if (!pdev) {
426426
dev_err(NULL, "pdev is NULL!\r\n");

0 commit comments

Comments
 (0)