From 24a26ae1b8e003766c2032bab4b05b3400480382 Mon Sep 17 00:00:00 2001 From: WangYuli Date: Wed, 27 Nov 2024 18:19:58 +0800 Subject: [PATCH] eth: yt6801: donot assigning value of variable of type to itself Fix follow compile errors with clang-19: drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c:478:14: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign] 478 | start_index = start_index; | ~~~~~~~~~~~ ^ ~~~~~~~~~~~ 1 error generated. drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:497:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign] 497 | pdata = pdata; | ~~~~~ ^ ~~~~~ drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:623:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign] 623 | pdata = pdata; | ~~~~~ ^ ~~~~~ drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:1232:8: error: explicitly assigning value of variable of type 'struct fxgmac_pdata *' to itself [-Werror,-Wself-assign] 1232 | pdata = pdata; | ~~~~~ ^ ~~~~~ drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:2321:7: error: explicitly assigning value of variable of type 'unsigned int' to itself [-Werror,-Wself-assign] 2321 | type = type; | ~~~~ ^ ~~~~ drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:4566:9: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign] 4566 | int_id = int_id; | ~~~~~~ ^ ~~~~~~ drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c:4888:8: error: explicitly assigning value of variable of type 'int' to itself [-Werror,-Wself-assign] 4888 | speed = speed; | ~~~~~ ^ ~~~~~ 6 errors generated. Signed-off-by: WangYuli --- .../motorcomm/yt6801/fuxi-gmac-desc.c | 2 +- .../ethernet/motorcomm/yt6801/fuxi-gmac-hw.c | 27 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c b/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c index 933e91e1408d..ca11dffc7e61 100644 --- a/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c +++ b/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-desc.c @@ -475,7 +475,7 @@ static void fxgmac_tx_desc_init_channel(struct fxgmac_channel *channel) struct fxgmac_desc_data *desc_data; int start_index = ring->cur; unsigned int i; - start_index = start_index; + /* Initialize all descriptors */ for (i = 0; i < ring->dma_desc_count; i++) { desc_data = FXGMAC_GET_DESC_DATA(ring, i); diff --git a/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c b/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c index 4c2191e3f375..cb23bea974fa 100644 --- a/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c +++ b/drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-hw.c @@ -482,10 +482,11 @@ static void fxgmac_config_multicast_mac_hash_table(struct fxgmac_pdata *pdata, writereg(pdata->pAdapter, regval, pdata->mac_regs + hash_reg); } -static void fxgmac_set_mac_hash_table(struct fxgmac_pdata *pdata) -{ #ifndef DPDK #if FXGMAC_MAC_HASH_TABLE +static void fxgmac_set_mac_hash_table(struct fxgmac_pdata *pdata) +{ + struct net_device *netdev = pdata->netdev; struct netdev_hw_addr *ha; @@ -493,13 +494,13 @@ static void fxgmac_set_mac_hash_table(struct fxgmac_pdata *pdata) netdev_for_each_mc_addr(ha, netdev) { fxgmac_config_multicast_mac_hash_table(pdata, ha->addr, 1); } -#endif - pdata = pdata; - +} #else - (void)pdata; -#endif +static inline void fxgmac_set_mac_hash_table(void) +{ } +#endif /* FXGMAC_MAC_HASH_TABLE */ +#endif /* DPDK */ static int fxgmac_set_mc_addresses(struct fxgmac_pdata *pdata) { @@ -612,16 +613,14 @@ static int fxgmac_config_rx_mode(struct fxgmac_pdata *pdata) return 0; } +#ifdef FXGMAC_WAIT_TX_STOP static void fxgmac_prepare_tx_stop(struct fxgmac_pdata *pdata, struct fxgmac_channel *channel) { -#ifdef FXGMAC_WAIT_TX_STOP unsigned int tx_dsr, tx_pos, tx_qidx; unsigned long tx_timeout; unsigned int tx_status; - pdata = pdata; - /* Calculate the status register to read and the position within */ if (channel->queue_index < DMA_DSRX_FIRST_QUEUE) { tx_dsr = DMA_DSR0; @@ -655,11 +654,12 @@ static void fxgmac_prepare_tx_stop(struct fxgmac_pdata *pdata, netdev_info(pdata->netdev, "timed out waiting for Tx DMA channel %u to stop\n", channel->queue_index); +} #else - pdata = pdata; - channel = channel; -#endif +static inline void fxgmac_prepare_tx_stop(void) +{ } +#endif /* FXGMAC_WAIT_TX_STOP */ static void fxgmac_enable_tx(struct fxgmac_pdata *pdata) { @@ -1229,7 +1229,6 @@ static void fxgmac_config_rx_fup_enable(struct fxgmac_pdata *pdata) static int fxgmac_config_tx_coalesce(struct fxgmac_pdata *pdata) { - pdata = pdata; return 0; }