netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] qlcnic: fix a timeout loop
@ 2015-12-15 10:16 Dan Carpenter
  2015-12-15 13:46 ` Manish Chopra
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2015-12-15 10:16 UTC (permalink / raw)
  To: Dept-GELinuxNICDev, Rajesh Borundia; +Cc: netdev, kernel-janitors

The problem here is that at the end of the loop we test for if
idc->vnic_wait_limit is zero, but since idc->vnic_wait_limit-- is a
post-op, it actually ends up set to (u8)-1.  I have fixed this by
changing it to a pre-op.  I had to change the starting value from
"QLCNIC_DEV_NPAR_OPER_TIMEO" (30) to "QLCNIC_DEV_NPAR_OPER_TIMEO + 1" so
that we still loop the same number of times as before.

Fixes: 486a5bc77a4a ('qlcnic: Add support for 83xx suspend and resume.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
index be7d7a6..9919245 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
@@ -234,7 +234,7 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *adapter)
 	}
 
 	ahw->idc.vnic_state = QLCNIC_DEV_NPAR_NON_OPER;
-	ahw->idc.vnic_wait_limit = QLCNIC_DEV_NPAR_OPER_TIMEO;
+	ahw->idc.vnic_wait_limit = QLCNIC_DEV_NPAR_OPER_TIMEO + 1;
 
 	return 0;
 }
@@ -246,7 +246,7 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
 	u32 state;
 
 	state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);
-	while (state != QLCNIC_DEV_NPAR_OPER && idc->vnic_wait_limit--) {
+	while (state != QLCNIC_DEV_NPAR_OPER && --idc->vnic_wait_limit) {
 		msleep(1000);
 		state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);
 	}

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

end of thread, other threads:[~2016-01-05 19:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 10:16 [patch] qlcnic: fix a timeout loop Dan Carpenter
2015-12-15 13:46 ` Manish Chopra
2015-12-15 13:56   ` [patch v2] " Dan Carpenter
2015-12-15 18:13     ` David Miller
2015-12-15 20:13       ` Dan Carpenter
2015-12-15 20:17         ` Dan Carpenter
2015-12-24  9:21           ` [patch] qlcnic: fix a loop exit condition better Dan Carpenter
2015-12-24 16:02             ` David Miller
2016-01-04 13:19     ` [patch v2] qlcnic: fix a timeout loop Yann Dupont - Veille Techno
2016-01-05 19:30       ` Dan Carpenter
2015-12-15 16:35   ` [patch] " walter harms

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