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

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

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


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

* Re: [PATCH] cassini: i reaches 0, not -1.
  2009-02-09 22:12 [PATCH] cassini: i reaches 0, not -1 Roel Kluin
@ 2009-02-10  1:56 ` David Miller
  2009-02-10  9:18   ` Roel Kluin
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2009-02-10  1:56 UTC (permalink / raw)
  To: roel.kluin; +Cc: netdev, linux-kernel

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$ 

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

* Re: [PATCH] cassini: i reaches 0, not -1.
  2009-02-10  1:56 ` David Miller
@ 2009-02-10  9:18   ` Roel Kluin
  0 siblings, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2009-02-10  9:18 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: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 :-/

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 22:12 [PATCH] cassini: i reaches 0, not -1 Roel Kluin
2009-02-10  1:56 ` David Miller
2009-02-10  9:18   ` 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).