Patchwork max_retries reaches -1, not 0

login
register
mail settings
Submitter roel kluin
Date Feb. 10, 2009, 10:43 p.m.
Message ID <499202F4.3020408@gmail.com>
Download mbox | patch
Permalink /patch/22894/
State Accepted
Commit 43950a605dc76677f0c74dcd818a57d4df040e12
Headers show

Comments

roel kluin - Feb. 10, 2009, 10:43 p.m.
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>
---
Sascha Hauer - Feb. 11, 2009, 8:54 a.m.
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);
>  	}

Patch

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);
 	}