[PATCH] mtd: chips: Remove for loop which never execute more than once

Rex Nie posted 1 patch 1 week, 1 day ago
drivers/mtd/chips/cfi_cmdset_0002.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
[PATCH] mtd: chips: Remove for loop which never execute more than once
Posted by Rex Nie 1 week, 1 day ago
Since the loop increment is unreachable, the loop body will never
execute more than once. Remove it to simplify the code. Note that
this does not change the semantics of get_chip().

Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
---
 drivers/mtd/chips/cfi_cmdset_0002.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 9f2223d3e8e1..da221253d688 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -884,21 +884,18 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
 	switch (chip->state) {
 
 	case FL_STATUS:
-		for (;;) {
-			if (chip_ready(map, chip, adr, NULL))
-				break;
+		if (chip_ready(map, chip, adr, NULL))
+			return 0;
 
-			if (time_after(jiffies, timeo)) {
-				printk(KERN_ERR "Waiting for chip to be ready timed out.\n");
-				return -EIO;
-			}
-			mutex_unlock(&chip->mutex);
-			cfi_udelay(1);
-			mutex_lock(&chip->mutex);
-			/* Someone else might have been playing with it. */
-			goto retry;
+		if (time_after(jiffies, timeo)) {
+			printk(KERN_ERR "Waiting for chip to be ready timed out.\n");
+			return -EIO;
 		}
-		return 0;
+		mutex_unlock(&chip->mutex);
+		cfi_udelay(1);
+		mutex_lock(&chip->mutex);
+		/* Someone else might have been playing with it. */
+		goto retry;
 
 	case FL_READY:
 	case FL_CFI_QUERY:
-- 
2.17.1