* [PATCH] postfix decrement error in smc911x_reset(); drivers/net/smc911x.c
@ 2007-11-04 23:45 Roel Kluin
2007-11-04 23:49 ` Roel Kluin
0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2007-11-04 23:45 UTC (permalink / raw)
To: netdev
If timeout causes the loop to end, a postfix decrement causes its value to
become 4294967295 (unsigned int), not 0.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dd18af0..41f3c8f 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -243,7 +243,7 @@ static void smc911x_reset(struct net_device *dev)
do {
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] postfix decrement error in smc911x_reset(); drivers/net/smc911x.c
2007-11-04 23:45 [PATCH] postfix decrement error in smc911x_reset(); drivers/net/smc911x.c Roel Kluin
@ 2007-11-04 23:49 ` Roel Kluin
2007-11-04 23:59 ` Roel Kluin
0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2007-11-04 23:49 UTC (permalink / raw)
To: netdev
And there was another one...
--
If timeout causes the loop to end, a postfix decrement causes its value to
become 4294967295 (unsigned int), not 0.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dd18af0..fac1d2a 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -243,7 +243,7 @@ static void smc911x_reset(struct net_device *dev)
do {
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;
@@ -267,7 +267,7 @@ static void smc911x_reset(struct net_device *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);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] postfix decrement error in smc911x_reset(); drivers/net/smc911x.c
2007-11-04 23:49 ` Roel Kluin
@ 2007-11-04 23:59 ` Roel Kluin
0 siblings, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2007-11-04 23:59 UTC (permalink / raw)
To: netdev
Darn, another. Sorry for the noise; I also removed a whitespace in this one
--
If timeout causes the loop to end, a postfix decrement causes its value to
become 4294967295 (unsigned int), not 0.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index dd18af0..6a2d236 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -243,7 +243,7 @@ static void smc911x_reset(struct net_device *dev)
do {
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;
@@ -267,7 +267,7 @@ static void smc911x_reset(struct net_device *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);
@@ -413,7 +413,7 @@ static inline void smc911x_drop_pkt(struct net_device *dev)
do {
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);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-04 23:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-04 23:45 [PATCH] postfix decrement error in smc911x_reset(); drivers/net/smc911x.c Roel Kluin
2007-11-04 23:49 ` Roel Kluin
2007-11-04 23:59 ` Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).