Skip to contentSkip to conversation

mtd: cfi_cmdset_0002: allow retry/timeout loop to exit

PATCH In review Brian Norris 1 participant 2 messages Jul 22, 2014 – Aug 5, 2014 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: cfi_cmdset_0002: allow retry/timeout loop to exit

The variable 'retries' is never modified, so if the reset operation never is going to complete, we'll get stuck in an infinite loop.

It looks like the intention was to decrement 'retries' on every loop. Untested.

Caught by Coverity.

---
Untested

 drivers/mtd/chips/cfi_cmdset_0002.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/chips/cfi_cmdset_0002.c +2 -0
index 5a4bfe33112a..6da141af9cba 100644
@@ -2029,6 +2029,8 @@ static int cfi_amdstd_panic_wait(struct map_info *map, struct flchip *chip,
 
 			udelay(1);
 		}
+
+		retries--;
 	}
 
 	/* the chip never became ready */
Signature · 1 line
1.9.1
#1 lore raw
Quoted 9 lines · Brian Norris

The variable 'retries' is never modified, so if the reset operation never is going to complete, we'll get stuck in an infinite loop.

It looks like the intention was to decrement 'retries' on every loop. Untested.

Caught by Coverity.

Pushed this and my other Coverity-inspired patches to l2-mtd.git/next.

Brian