Message ID | 4990AA32.1010004@gmail.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
From: Roel Kluin <roel.kluin@gmail.com> Date: Mon, 09 Feb 2009 23:12:02 +0100 > With while (i-- > 0) { ... } i reaches 0, not -1. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Does it? -------------------- #include <stdio.h> int main(void) { int i = 20; while (i-- > 0) ; printf("%d\n", i); return 0; } -------------------- davem@sunset:~/src/GIT/linux-2.6$ gcc -O2 -o x x.c davem@sunset:~/src/GIT/linux-2.6$ ./x -1 davem@sunset:~/src/GIT/linux-2.6$ -- 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 wrote: > From: Roel Kluin <roel.kluin@gmail.com> > Date: Mon, 09 Feb 2009 23:12:02 +0100 > >> With while (i-- > 0) { ... } i reaches 0, not -1. >> >> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > > Does it? No, you're right, sorry, please ignore :-/ -- 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/cassini.c b/drivers/net/cassini.c index bbbc3bb..2de2cdf 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -3568,7 +3568,7 @@ static inline void cas_start_dma(struct cas *cp) break; udelay(10); } - if (i < 0) txfailed = 1; + if (i <= 0) txfailed = 1; i = STOP_TRIES; while (i-- > 0) { val = readl(cp->regs + REG_MAC_RX_CFG);
With while (i-- > 0) { ... } i reaches 0, not -1. 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