Skip to contentSkip to conversation

netdevice: ticks reaches 25, not 26.

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

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 netdevice: ticks reaches 25, not 26.

With while (tick++ < 25) { ... } ticks reaches 25, not 26.

---

drivers/net/myri_sbus.c +1 -1
index 899ed06..a95e217 100644
@@ -161,7 +161,7 @@ static int myri_do_handshake(struct myri_eth *mp)
 
 	myri_enable_irq(mp->lregs, cregs);
 
-	if (tick > 25) {
+	if (tick >= 25) {
 		DET(("25 ticks we lose, failure.\n"));
 		return -1;
 	}
maintainer
#1 lore raw

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

Quoted 1 line

With while (tick++ < 25) { ... } ticks reaches 25, not 26.

Does it?

--------------------
#include <stdio.h>
int main(void)

{
	int i = 0;
	while (i++ < 25)
		;
	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
26
davem@sunset:~/src/GIT/linux-2.6$ 

I'm getting extremely tired of these "off by one" patches, to be honest with you.

#2 lore raw
Quoted 24 lines · David Miller

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

Quoted 1 line

With while (tick++ < 25) { ... } ticks reaches 25, not 26.

Does it?

--------------------
#include <stdio.h>
int main(void)

{
	int i = 0;
	while (i++ < 25)
		;
	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
26
davem@sunset:~/src/GIT/linux-2.6$ 
Quoted 2 lines

I'm getting extremely tired of these "off by one" patches, to be honest with you.

So, what other C feature do you find a better source of joy now?

Jarek P.

maintainer
#3 lore raw

From: Jarek Poplawski <[email protected]>
Date: Tue, 10 Feb 2009 08:50:21 +0000

Quoted 1 line

So, what other C feature do you find a better source of joy now?

None really, that's why most of my own patches lately have been doing nothing but remove code :-)

author
#4 lore raw
In reply to David Miller
Quoted 6 lines · David Miller

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

Quoted 1 line

With while (tick++ < 25) { ... } ticks reaches 25, not 26.

Does it?

Again, you're right, sorry, please ignore :-/