Skip to contentSkip to conversation

drivers/net/cxgb3/xgmac.c: remove dead code

PATCH In review Adrian Bunk 2 participants 2 messages Jul 29, 2007 – Jul 31, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/cxgb3/xgmac.c: remove dead code

This patch removes dead code ("tx_xcnt" can never be != 0 at this place) spotted by the Coverity checker.

---

 drivers/net/cxgb3/xgmac.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/cxgb3/xgmac.c renamed from drivers/net/cxgb3/xgmac.c.old +1 -4
@@ -510,38 +510,35 @@ int t3b2_mac_watchdog_task(struct cmac *
 	if (tx_mcnt == mac->tx_mcnt) {
 		tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
 						A_XGM_TX_SPI4_SOP_EOP_CNT +
 					       	mac->offset)));
 		if (tx_xcnt == 0) {
 			t3_write_reg(adap, A_TP_PIO_ADDR,
 				     A_TP_TX_DROP_CNT_CH0 + macidx(mac));
 			tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
 						      A_TP_PIO_DATA)));
 		} else {
 			goto rxcheck;
 		}
 	} else {
 		mac->toggle_cnt = 0;
 		goto rxcheck;
 	}
 
-	if (((tx_tcnt != mac->tx_tcnt) &&
-	     (tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
-	    ((mac->tx_mcnt == tx_mcnt) &&
-	     (tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
+	if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0))  {
 		if (mac->toggle_cnt > 4) {
 			status = 2;
 			goto out;
 		} else {
 			status = 1;
 			goto out;
 		}
 	} else {
 		mac->toggle_cnt = 0;
 		goto rxcheck;
 	}
 
 rxcheck:
 	if (rx_mcnt != mac->rx_mcnt)
 		rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
 						A_XGM_RX_SPI4_SOP_EOP_CNT +
 						mac->offset)));
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Adrian Bunk

This patch removes dead code ("tx_xcnt" can never be != 0 at this place) spotted by the Coverity checker.

Quoted 54 lines

---

 drivers/net/cxgb3/xgmac.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- linux-2.6.22-rc6-mm1/drivers/net/cxgb3/xgmac.c.old 2007-07-24 13:55:33.000000000 +0200
+++ linux-2.6.22-rc6-mm1/drivers/net/cxgb3/xgmac.c 2007-07-24
13:57:06.000000000 +0200

drivers/net/cxgb3/xgmac.c renamed from drivers/net/cxgb3/xgmac.c.old +0 -0
@@ -510,38 +510,35 @@ int t3b2_mac_watchdog_task(struct cmac *
        if (tx_mcnt == mac->tx_mcnt) {
                tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
 

A_XGM_TX_SPI4_SOP_EOP_CNT +

                                                mac->offset)));
                if (tx_xcnt == 0) {
                        t3_write_reg(adap, A_TP_PIO_ADDR,
                                     A_TP_TX_DROP_CNT_CH0 + macidx(mac));
                        tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
                                                      A_TP_PIO_DATA)));
                } else {
                        goto rxcheck;
                }
        } else {
                mac->toggle_cnt = 0;
                goto rxcheck;
        }
drivers/net/cxgb3/xgmac.c renamed from drivers/net/cxgb3/xgmac.c.old +1 -4
-       if (((tx_tcnt != mac->tx_tcnt) &&
-            (tx_xcnt == 0) && (mac->tx_xcnt == 0)) ||
-           ((mac->tx_mcnt == tx_mcnt) &&
-            (tx_xcnt != 0) && (mac->tx_xcnt != 0))) {
+       if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0))  {
                if (mac->toggle_cnt > 4) {
                        status = 2;
                        goto out;
                } else {
                        status = 1;
                        goto out;
                }
        } else {
                mac->toggle_cnt = 0;
                goto rxcheck;
        }
 
 rxcheck:
        if (rx_mcnt != mac->rx_mcnt)
                rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,

A_XGM_RX_SPI4_SOP_EOP_CNT +

                                                mac->offset)));