All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] max_retries reaches -1, not 0
@ 2009-02-10 22:43 Roel Kluin
  2009-02-11  8:54 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-10 22:43 UTC (permalink / raw)
  To: s.hauer, David.Woodhouse; +Cc: linux-mtd

With while (max_retries-- > 0) { ... } max_retries reaches -1, not 0,
so we shouldn't DEBUG() on a max_retries of 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 21fd4f1..5c34148 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -192,7 +192,7 @@ static void wait_op_done(struct mxc_nand_host *host, int max_retries,
 			}
 			udelay(1);
 		}
-		if (max_retries <= 0)
+		if (max_retries < 0)
 			DEBUG(MTD_DEBUG_LEVEL0, "%s(%d): INT not set\n",
 			      __func__, param);
 	}

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

* Re: [PATCH] max_retries reaches -1, not 0
  2009-02-10 22:43 [PATCH] max_retries reaches -1, not 0 Roel Kluin
@ 2009-02-11  8:54 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2009-02-11  8:54 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-mtd, David.Woodhouse

On Tue, Feb 10, 2009 at 11:43:00PM +0100, Roel Kluin wrote:
> With while (max_retries-- > 0) { ... } max_retries reaches -1, not 0,
> so we shouldn't DEBUG() on a max_retries of 0.

Yes, indeed.

> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index 21fd4f1..5c34148 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -192,7 +192,7 @@ static void wait_op_done(struct mxc_nand_host *host, int max_retries,
>  			}
>  			udelay(1);
>  		}
> -		if (max_retries <= 0)
> +		if (max_retries < 0)
>  			DEBUG(MTD_DEBUG_LEVEL0, "%s(%d): INT not set\n",
>  			      __func__, param);
>  	}


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

end of thread, other threads:[~2009-02-11  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-10 22:43 [PATCH] max_retries reaches -1, not 0 Roel Kluin
2009-02-11  8:54 ` Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.