smc911x: test after postfix decrement fails in smc911x_{reset,drop_pkt}
Subsystems (2)
PATCH 8/9 smc911x: test after postfix decrement fails in smc911x_{reset,drop_pkt}
From: Roel Kluin <[email protected]>
When timeout reaches 0 the postfix decrement still subtracts, so the test fails.
[[email protected]: coding-style fixes]
Signed-off-by Roel Kluin <[email protected]>
Acked-by Peter Korsgaard <[email protected]>
Cc Jeff Garzik <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/net/smc911x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/smc911x.c renamed from drivers/net/smc911x.c~smc911x-test-after-postfix-decrement-fails-in-smc911x_resetdrop_pkt +3 -3
@@ -244,7 +244,7 @@ static void smc911x_reset(struct net_devdo {udelay (10 ); reg =SMC_GET_PMT_CTRL () &PMT_CTRL_READY_ ; - }while ( timeout-- && !reg); + }while (--timeout && !reg);if (timeout ==0 ) {PRINTK ("%s: smc911x_reset timeout waiting for PM restore\n" , dev->name);return ;
@@ -268,7 +268,7 @@ static void smc911x_reset(struct net_dev resets++;break ; } - }while ( timeout-- && (reg &HW_CFG_SRST_ )); + }while (--timeout && (reg &HW_CFG_SRST_ )); }if (timeout ==0 ) {PRINTK ("%s: smc911x_reset timeout waiting for reset\n" , dev->name);
@@ -414,7 +414,7 @@ static inline void smc911x_drop_pkt(strudo {udelay (10 ); reg =SMC_GET_RX_DP_CTRL () &RX_DP_CTRL_FFWD_BUSY_ ; - }while ( timeout-- && reg); + }while (--timeout && reg);if (timeout ==0 ) {PRINTK ("%s: timeout waiting for RX fast forward\n" , dev->name); }
_
Jeff Garzik
AppliedQuoted 10 lines · [email protected] wrote:
From: Roel Kluin <[email protected]>
When timeout reaches 0 the postfix decrement still subtracts, so the test fails.
[[email protected]: coding-style fixes]Signed-off-by Roel Kluin <[email protected]>Acked-by Peter Korsgaard <[email protected]>Cc Jeff Garzik <[email protected]>Signed-off-by Andrew Morton <[email protected]>
applied