diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-02-03 00:39:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-03 00:39:02 -0500 |
commit | 46578a6913e6f5e69229561736b94c18c2e88ae4 (patch) | |
tree | 23db22f32e094dd971650528ea1d499bd2ab3015 /drivers/net/smsc9420.c | |
parent | 0047e5d240ede4e84c03bc9001375175900fd259 (diff) |
net: variables reach -1, but 0 tested
while (timeout--) { ... }
timeout becomes -1 if the loop isn't ended otherwise, not 0.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/smsc9420.c')
-rw-r--r-- | drivers/net/smsc9420.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index d801900a5036..a1e4b3895b33 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
@@ -498,7 +498,7 @@ static void smsc9420_check_mac_address(struct net_device *dev) | |||
498 | static void smsc9420_stop_tx(struct smsc9420_pdata *pd) | 498 | static void smsc9420_stop_tx(struct smsc9420_pdata *pd) |
499 | { | 499 | { |
500 | u32 dmac_control, mac_cr, dma_intr_ena; | 500 | u32 dmac_control, mac_cr, dma_intr_ena; |
501 | int timeOut = 1000; | 501 | int timeout = 1000; |
502 | 502 | ||
503 | /* disable TX DMAC */ | 503 | /* disable TX DMAC */ |
504 | dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL); | 504 | dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL); |
@@ -506,13 +506,13 @@ static void smsc9420_stop_tx(struct smsc9420_pdata *pd) | |||
506 | smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control); | 506 | smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control); |
507 | 507 | ||
508 | /* Wait max 10ms for transmit process to stop */ | 508 | /* Wait max 10ms for transmit process to stop */ |
509 | while (timeOut--) { | 509 | while (--timeout) { |
510 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_) | 510 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_) |
511 | break; | 511 | break; |
512 | udelay(10); | 512 | udelay(10); |
513 | } | 513 | } |
514 | 514 | ||
515 | if (!timeOut) | 515 | if (!timeout) |
516 | smsc_warn(IFDOWN, "TX DMAC failed to stop"); | 516 | smsc_warn(IFDOWN, "TX DMAC failed to stop"); |
517 | 517 | ||
518 | /* ACK Tx DMAC stop bit */ | 518 | /* ACK Tx DMAC stop bit */ |
@@ -596,7 +596,7 @@ static void smsc9420_free_rx_ring(struct smsc9420_pdata *pd) | |||
596 | 596 | ||
597 | static void smsc9420_stop_rx(struct smsc9420_pdata *pd) | 597 | static void smsc9420_stop_rx(struct smsc9420_pdata *pd) |
598 | { | 598 | { |
599 | int timeOut = 1000; | 599 | int timeout = 1000; |
600 | u32 mac_cr, dmac_control, dma_intr_ena; | 600 | u32 mac_cr, dmac_control, dma_intr_ena; |
601 | 601 | ||
602 | /* mask RX DMAC interrupts */ | 602 | /* mask RX DMAC interrupts */ |
@@ -617,13 +617,13 @@ static void smsc9420_stop_rx(struct smsc9420_pdata *pd) | |||
617 | smsc9420_pci_flush_write(pd); | 617 | smsc9420_pci_flush_write(pd); |
618 | 618 | ||
619 | /* wait up to 10ms for receive to stop */ | 619 | /* wait up to 10ms for receive to stop */ |
620 | while (timeOut--) { | 620 | while (--timeout) { |
621 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_) | 621 | if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_) |
622 | break; | 622 | break; |
623 | udelay(10); | 623 | udelay(10); |
624 | } | 624 | } |
625 | 625 | ||
626 | if (!timeOut) | 626 | if (!timeout) |
627 | smsc_warn(IFDOWN, "RX DMAC did not stop! timeout."); | 627 | smsc_warn(IFDOWN, "RX DMAC did not stop! timeout."); |
628 | 628 | ||
629 | /* ACK the Rx DMAC stop bit */ | 629 | /* ACK the Rx DMAC stop bit */ |