From: Brian Norris Date: Tue, 22 Jul 2014 02:06:19 +0000 (-0700) Subject: mtd: cfi_cmdset_0002: allow retry/timeout loop to exit X-Git-Tag: v3.18-rc1~25^2~33^2~16 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=36c6a7ac74044b8025488c018279115bb3c32eb0;p=uclinux-h8%2Flinux.git 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. Signed-off-by: Brian Norris --- diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 5a4bfe33112a..6da141af9cba 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -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 */