Patchwork netdevice: ticks reaches 25, not 26.

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

Comments

roel kluin - Feb. 9, 2009, 10:22 p.m.
With while (tick++ < 25) { ... } ticks reaches 25, not 26.

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:57 a.m.
From: Roel Kluin <roel.kluin@gmail.com>
Date: Mon, 09 Feb 2009 23:22:11 +0100

> 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.
--
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
Jarek Poplawski - Feb. 10, 2009, 8:50 a.m.
On 10-02-2009 02:57, David Miller wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
> Date: Mon, 09 Feb 2009 23:22:11 +0100
> 
>> 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.

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

Jarek P.
--
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, 8:59 a.m.
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Tue, 10 Feb 2009 08:50:21 +0000

> 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 :-)
--
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:19 a.m.
David Miller wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
> Date: Mon, 09 Feb 2009 23:22:11 +0100
> 
>> With while (tick++ < 25) { ... } ticks reaches 25, not 26.
> 
> Does it?

Again, 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/myri_sbus.c b/drivers/net/myri_sbus.c
index 899ed06..a95e217 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -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;
 	}