lkml.org 
[lkml]   [2015]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Fix an infinite retry-loop
Date
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


\
 
 \ /
  Last update: 2015-01-04 20:21    [W:0.042 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site