diff mbox

cassini: i reaches 0, not -1.

Message ID 4990AA32.1010004@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

roel kluin Feb. 9, 2009, 10:12 p.m. UTC
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

Comments

David Miller Feb. 10, 2009, 1:56 a.m. UTC | #1
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. UTC | #2
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 mbox

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