Skip to contentSkip to conversation

max_retries reaches -1, not 0

PATCH In review Roel Kluin 2 participants 2 messages Feb 10, 2009 – Feb 11, 2009

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 max_retries reaches -1, not 0

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

---

drivers/mtd/nand/mxc_nand.c +1 -1
index 21fd4f1..5c34148 100644
@@ -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);
 	}
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Roel Kluin

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

Yes, indeed.

Quoted 2 lines
Quoted 14 lines

---

drivers/mtd/nand/mxc_nand.c +1 -1
index 21fd4f1..5c34148 100644
@@ -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);
 	}
Signature · 4 lines
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 |