Skip to contentSkip to conversation

cassini: i reaches 0, not -1.

PATCH In review Roel Kluin 2 participants 3 messages Feb 9, 2009 – Feb 10, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 cassini: i reaches 0, not -1.

With while (i-- > 0) { ... } i reaches 0, not -1.

---

drivers/net/cassini.c +1 -1
index bbbc3bb..2de2cdf 100644
@@ -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);
maintainer
#1 lore raw

From: Roel Kluin <[email protected]>
Date: Mon, 09 Feb 2009 23:12:02 +0100

Quoted 3 lines

With while (i-- > 0) { ... } i reaches 0, not -1.

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$