linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: cfi_cmdset_0002: allow retry/timeout loop to exit
@ 2014-07-22  2:06 Brian Norris
  2014-08-05 21:53 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Norris @ 2014-07-22  2:06 UTC (permalink / raw)
  To: linux-mtd; +Cc: Bean Huo, Brian Norris, Christian Riesch

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 <computersforpeace@gmail.com>
---
Untested

 drivers/mtd/chips/cfi_cmdset_0002.c | 2 ++
 1 file changed, 2 insertions(+)

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 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: cfi_cmdset_0002: allow retry/timeout loop to exit
  2014-07-22  2:06 [PATCH] mtd: cfi_cmdset_0002: allow retry/timeout loop to exit Brian Norris
@ 2014-08-05 21:53 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2014-08-05 21:53 UTC (permalink / raw)
  To: linux-mtd; +Cc: Bean Huo, Christian Riesch

On Mon, Jul 21, 2014 at 07:06:19PM -0700, Brian Norris wrote:
> 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 <computersforpeace@gmail.com>

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

Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-05 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-22  2:06 [PATCH] mtd: cfi_cmdset_0002: allow retry/timeout loop to exit Brian Norris
2014-08-05 21:53 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).