netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netdevice: ticks reaches 25, not 26.
@ 2009-02-09 22:22 Roel Kluin
  2009-02-10  1:57 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2009-02-09 22:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, lkml

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
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;
 	}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] netdevice: ticks reaches 25, not 26.
  2009-02-09 22:22 [PATCH] netdevice: ticks reaches 25, not 26 Roel Kluin
@ 2009-02-10  1:57 ` David Miller
  2009-02-10  8:50   ` Jarek Poplawski
  2009-02-10  9:19   ` Roel Kluin
  0 siblings, 2 replies; 5+ messages in thread
From: David Miller @ 2009-02-10  1:57 UTC (permalink / raw)
  To: roel.kluin; +Cc: netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netdevice: ticks reaches 25, not 26.
  2009-02-10  1:57 ` David Miller
@ 2009-02-10  8:50   ` Jarek Poplawski
  2009-02-10  8:59     ` David Miller
  2009-02-10  9:19   ` Roel Kluin
  1 sibling, 1 reply; 5+ messages in thread
From: Jarek Poplawski @ 2009-02-10  8:50 UTC (permalink / raw)
  To: David Miller; +Cc: roel.kluin, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netdevice: ticks reaches 25, not 26.
  2009-02-10  8:50   ` Jarek Poplawski
@ 2009-02-10  8:59     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-02-10  8:59 UTC (permalink / raw)
  To: jarkao2; +Cc: roel.kluin, netdev, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netdevice: ticks reaches 25, not 26.
  2009-02-10  1:57 ` David Miller
  2009-02-10  8:50   ` Jarek Poplawski
@ 2009-02-10  9:19   ` Roel Kluin
  1 sibling, 0 replies; 5+ messages in thread
From: Roel Kluin @ 2009-02-10  9:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-kernel

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 :-/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-10  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 22:22 [PATCH] netdevice: ticks reaches 25, not 26 Roel Kluin
2009-02-10  1:57 ` David Miller
2009-02-10  8:50   ` Jarek Poplawski
2009-02-10  8:59     ` David Miller
2009-02-10  9:19   ` Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).