Skip to content

Commit

Permalink
qlcnic: fix a timeout loop
Browse files Browse the repository at this point in the history
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: 486a5bc ('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>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Dec 15, 2015
1 parent fe0be35 commit 389e4e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 389e4e0

Please sign in to comment.