netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qla3xxx: don't allow never end busy loop
@ 2015-01-06 21:17 Andy Shevchenko
  2015-01-06 22:41 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2015-01-06 21:17 UTC (permalink / raw)
  To: netdev, linux-driver, David S . Miller; +Cc: Andy Shevchenko

The counter variable wasn't increased at all which may stuck under
certain circumstances.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index c2f09af..4847713 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -146,10 +146,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
 {
 	int i = 0;
 
-	while (i < 10) {
-		if (i)
-			ssleep(1);
-
+	do {
 		if (ql_sem_lock(qdev,
 				QL_DRVR_SEM_MASK,
 				(QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index)
@@ -158,7 +155,8 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
 				      "driver lock acquired\n");
 			return 1;
 		}
-	}
+		ssleep(1);
+	} while (++i < 10);
 
 	netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n");
 	return 0;
-- 
1.8.3.101.g727a46b

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

* Re: [PATCH] qla3xxx: don't allow never end busy loop
  2015-01-06 21:17 [PATCH] qla3xxx: don't allow never end busy loop Andy Shevchenko
@ 2015-01-06 22:41 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-06 22:41 UTC (permalink / raw)
  To: andy.shevchenko; +Cc: netdev, linux-driver

From: Andy Shevchenko <andy.shevchenko@gmail.com>
Date: Tue,  6 Jan 2015 23:17:53 +0200

> The counter variable wasn't increased at all which may stuck under
> certain circumstances.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2015-01-06 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 21:17 [PATCH] qla3xxx: don't allow never end busy loop Andy Shevchenko
2015-01-06 22:41 ` David Miller

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