Patchwork smsc911x: timeout reaches -1

login
register
mail settings
Submitter roel kluin
Date Jan. 29, 2009, 3:12 p.m.
Message ID <4981C743.90202@gmail.com>
Download mbox | patch
Permalink /patch/21014/
State Accepted
Delegated to: David Miller
Headers show

Comments

roel kluin - Jan. 29, 2009, 3:12 p.m.
With a postfix decrement the timeout will reach -1 rather than 0,
so the warning will not be issued.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
--
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
Steve Glendinning - Jan. 29, 2009, 3:22 p.m.
Roel Kluin <roel.kluin@gmail.com> wrote on 29/01/2009 15:12:03:

> With a postfix decrement the timeout will reach -1 rather than 0,
> so the warning will not be issued.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
> index f513bdf..783c1a7 100644
> --- a/drivers/net/smsc911x.c
> +++ b/drivers/net/smsc911x.c
> @@ -953,7 +953,7 @@ smsc911x_rx_fastforward(struct smsc911x_data 
> *pdata, unsigned int pktbytes)
>        do {
>           udelay(1);
>           val = smsc911x_reg_read(pdata, RX_DP_CTRL);
> -      } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_));
> +      } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
> 
>        if (unlikely(timeout == 0))
>           SMSC_WARNING(HW, "Timed out waiting for "

Thanks for spotting this Roel.

Acked-by: Steve Glendinning <steve.glendinning@smsc.com>

--
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
David Miller - Jan. 30, 2009, 1:30 a.m.
From: Steve.Glendinning@smsc.com
Date: Thu, 29 Jan 2009 15:22:03 +0000

> Roel Kluin <roel.kluin@gmail.com> wrote on 29/01/2009 15:12:03:
> 
> > With a postfix decrement the timeout will reach -1 rather than 0,
> > so the warning will not be issued.
> > 
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> > ---
> > diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
> > index f513bdf..783c1a7 100644
> > --- a/drivers/net/smsc911x.c
> > +++ b/drivers/net/smsc911x.c
> > @@ -953,7 +953,7 @@ smsc911x_rx_fastforward(struct smsc911x_data 
> > *pdata, unsigned int pktbytes)
> >        do {
> >           udelay(1);
> >           val = smsc911x_reg_read(pdata, RX_DP_CTRL);
> > -      } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_));
> > +      } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
> > 
> >        if (unlikely(timeout == 0))
> >           SMSC_WARNING(HW, "Timed out waiting for "
> 
> Thanks for spotting this Roel.
> 
> Acked-by: Steve Glendinning <steve.glendinning@smsc.com>

Applied, thanks everyone.
--
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

Patch

diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index f513bdf..783c1a7 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -953,7 +953,7 @@  smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
 		do {
 			udelay(1);
 			val = smsc911x_reg_read(pdata, RX_DP_CTRL);
-		} while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_));
+		} while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
 
 		if (unlikely(timeout == 0))
 			SMSC_WARNING(HW, "Timed out waiting for "