netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix an infinite retry-loop
@ 2015-01-04 18:04 Giel van Schijndel
  2015-01-04 23:04 ` Giel van Schijndel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Giel van Schijndel @ 2015-01-04 18:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Giel van Schijndel, Jitendra Kalsaria, Ron Mercer,
	supporter:QLOGIC QLA3XXX NE..., open list:QLOGIC QLA3XXX NE...

This was clearly intended as a retry-10-times loop, but due to the
absence of code incrementing the loop-counter it was practically a
retry-forever loop.

Rewritten it as a for-loop as well to make the loop-counter increment
(as well as its potential absence) easier to spot.
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index c2f09af..35a26c9 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -144,9 +144,9 @@ static int ql_sem_lock(struct ql3_adapter *qdev, u32 sem_mask, u32 sem_bits)
  */
 static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
 {
-	int i = 0;
+	int i;
 
-	while (i < 10) {
+	for (i = 0; i < 10; ++i) {
 		if (i)
 			ssleep(1);
 
-- 
2.1.4

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

end of thread, other threads:[~2015-01-07 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-04 18:04 [PATCH] Fix an infinite retry-loop Giel van Schijndel
2015-01-04 23:04 ` Giel van Schijndel
2015-01-05  4:48 ` David Miller
2015-01-07 18:39 ` Andy Shevchenko

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).