netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -mainline] qlge: fix a timeout loop in ql_change_rx_buffers()
@ 2015-12-15 10:52 Dan Carpenter
  2015-12-15 17:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-12-15 10:52 UTC (permalink / raw)
  To: Harish Patil
  Cc: Sudarsana Kalluru, Dept-GELinuxNICDev, linux-driver, netdev,
	kernel-janitors

The problem here is that after the loop we test for "if (!i) " but
because "i--" is a post-op we exit with i set to -1.  I have fixed this
by changing it to a pre-op instead.  I had to change the starting value
from 3 to 4 so that we still iterate 3 times.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 02b7115..9979764 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4211,8 +4211,9 @@ static int ql_change_rx_buffers(struct ql_adapter *qdev)
 
 	/* Wait for an outstanding reset to complete. */
 	if (!test_bit(QL_ADAPTER_UP, &qdev->flags)) {
-		int i = 3;
-		while (i-- && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
+		int i = 4;
+
+		while (--i && !test_bit(QL_ADAPTER_UP, &qdev->flags)) {
 			netif_err(qdev, ifup, qdev->ndev,
 				  "Waiting for adapter UP...\n");
 			ssleep(1);

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

* Re: [patch -mainline] qlge: fix a timeout loop in ql_change_rx_buffers()
  2015-12-15 10:52 [patch -mainline] qlge: fix a timeout loop in ql_change_rx_buffers() Dan Carpenter
@ 2015-12-15 17:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-12-15 17:52 UTC (permalink / raw)
  To: dan.carpenter
  Cc: harish.patil, sudarsana.kalluru, Dept-GELinuxNICDev, linux-driver,
	netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 15 Dec 2015 13:52:36 +0300

> The problem here is that after the loop we test for "if (!i) " but
> because "i--" is a post-op we exit with i set to -1.  I have fixed this
> by changing it to a pre-op instead.  I had to change the starting value
> from 3 to 4 so that we still iterate 3 times.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2015-12-15 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 10:52 [patch -mainline] qlge: fix a timeout loop in ql_change_rx_buffers() Dan Carpenter
2015-12-15 17:52 ` 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).