Message ID | 49A5286D.80304@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, 25 Feb 2009 12:15:57 +0100, Roel Kluin wrote > These were not previously reported by me. > ------------------------------>8-------------8<--------------------------------- > with while (timeout-- > 0); timeout reaches -1 after the loop, so the tests > below are off by one. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > --- > drivers/net/arm/ks8695net.c | 2 +- > drivers/net/jme.c | 3 ++- > drivers/net/ucc_geth_mii.c | 2 +- > 3 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c > index 1cf2f94..f3a1274 100644 > --- a/drivers/net/arm/ks8695net.c > +++ b/drivers/net/arm/ks8695net.c > @@ -560,7 +560,7 @@ ks8695_reset(struct ks8695_priv *ksp) > msleep(1); > } > > - if (reset_timeout == 0) { > + if (reset_timeout < 0) { > dev_crit(ksp->dev, > "Timeout waiting for DMA engines to reset\n"); > /* And blithely carry on */ > diff --git a/drivers/net/jme.c b/drivers/net/jme.c > index 08b3405..0173ed0 100644 > --- a/drivers/net/jme.c > +++ b/drivers/net/jme.c > @@ -957,7 +957,8 @@ jme_process_receive(struct jme_adapter *jme, int limit) > goto out_inc; > > i = atomic_read(&rxring->next_to_clean); > - while (limit-- > 0) { > + while (limit > 0) { > + limit--; > rxdesc = rxring->desc; > rxdesc += i; > There should be no difference after this modification. The return value of this function is: "limit > 0 ? limit : 0;" > diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c > index 5463591..7b1b46c 100644 > --- a/drivers/net/ucc_geth_mii.c > +++ b/drivers/net/ucc_geth_mii.c > @@ -123,7 +123,7 @@ static int uec_mdio_reset(struct mii_bus *bus) > > mutex_unlock(&bus->mdio_lock); > > - if (timeout <= 0) { > + if (timeout < 0) { > printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name); > return -EBUSY; > } > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Guo-Fu Tseng -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Feb 27, 2009 at 12:43 PM, Guo-Fu Tseng <cooldavid@cooldavid.org> wrote: > On Wed, 25 Feb 2009 12:15:57 +0100, Roel Kluin wrote >> These were not previously reported by me. >> ------------------------------>8-------------8<--------------------------------- >> with while (timeout-- > 0); timeout reaches -1 after the loop, so the tests >> below are off by one. >> >> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> >> --- >> diff --git a/drivers/net/jme.c b/drivers/net/jme.c >> index 08b3405..0173ed0 100644 >> --- a/drivers/net/jme.c >> +++ b/drivers/net/jme.c >> @@ -957,7 +957,8 @@ jme_process_receive(struct jme_adapter *jme, int limit) >> goto out_inc; >> >> i = atomic_read(&rxring->next_to_clean); >> - while (limit-- > 0) { >> + while (limit > 0) { >> + limit--; >> rxdesc = rxring->desc; >> rxdesc += i; >> > There should be no difference after this modification. > The return value of this function is: "limit > 0 ? limit : 0;" There is: In the last iteration limit is 1 during the test before it is decremented to 0. rxdesc = rxring->desc; rxdesc += i; If then we break out of the loop by the 'goto out;', we continue with: out: atomic_set(&rxring->next_to_clean, i); out_inc: atomic_inc(&jme->rx_cleaning); but since limit is already decremented, 0 is returned. > > Guo-Fu Tseng > Roel -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Roel Kluin <roel.kluin@gmail.com> Date: Wed, 25 Feb 2009 12:15:57 +0100 > These were not previously reported by me. > ------------------------------>8-------------8<--------------------------------- > with while (timeout-- > 0); timeout reaches -1 after the loop, so the tests > below are off by one. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c index 1cf2f94..f3a1274 100644 --- a/drivers/net/arm/ks8695net.c +++ b/drivers/net/arm/ks8695net.c @@ -560,7 +560,7 @@ ks8695_reset(struct ks8695_priv *ksp) msleep(1); } - if (reset_timeout == 0) { + if (reset_timeout < 0) { dev_crit(ksp->dev, "Timeout waiting for DMA engines to reset\n"); /* And blithely carry on */ diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 08b3405..0173ed0 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c @@ -957,7 +957,8 @@ jme_process_receive(struct jme_adapter *jme, int limit) goto out_inc; i = atomic_read(&rxring->next_to_clean); - while (limit-- > 0) { + while (limit > 0) { + limit--; rxdesc = rxring->desc; rxdesc += i; diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index 5463591..7b1b46c 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c @@ -123,7 +123,7 @@ static int uec_mdio_reset(struct mii_bus *bus) mutex_unlock(&bus->mdio_lock); - if (timeout <= 0) { + if (timeout < 0) { printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name); return -EBUSY; }
These were not previously reported by me. ------------------------------>8-------------8<--------------------------------- with while (timeout-- > 0); timeout reaches -1 after the loop, so the tests below are off by one. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> --- drivers/net/arm/ks8695net.c | 2 +- drivers/net/jme.c | 3 ++- drivers/net/ucc_geth_mii.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html