qlcnic: fix a timeout loop
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 15 Dec 2015 13:56:16 +0000 (16:56 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Dec 2015 18:11:05 +0000 (13:11 -0500)
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
moving the decrement inside the loop.

Fixes: 486a5bc77a4a ('qlcnic: Add support for 83xx suspend and resume.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c

index be7d7a62cc0d8c885c1f669f6c01f0f3a2259ea0..b1a452f291ee229866aae5d051385272e17e40dc 100644 (file)
@@ -246,7 +246,8 @@ 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) {
+               idc->vnic_wait_limit--;
                msleep(1000);
                state = QLCRDX(ahw, QLC_83XX_VNIC_STATE);
        }