Patchwork cassini: i reaches 0, not -1.

login
register
mail settings
Submitter roel kluin
Date Feb. 9, 2009, 10:12 p.m.
Message ID <4990AA32.1010004@gmail.com>
Download mbox | patch
Permalink /patch/22817/
State Rejected
Delegated to: David Miller
Headers show

Comments

roel kluin - Feb. 9, 2009, 10:12 p.m.
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
David Miller - Feb. 10, 2009, 1:56 a.m.
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
roel kluin - Feb. 10, 2009, 9:18 a.m.
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

Patch

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);