diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-04-19 17:23:44 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-04-26 12:28:56 +0300 |
commit | 394f0ed53108d5e038910e3eb733ccd3f0d9c464 (patch) | |
tree | b2bf9edacccf33ce78ad08dedf2380b00e2aab88 /drivers/net/wireless/marvell/mwifiex/usb.c | |
parent | e0bdef0f75f0ee0d4747b72fa75310da78dbfa56 (diff) | |
download | linux-394f0ed53108d5e038910e3eb733ccd3f0d9c464.tar.xz |
mwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()
USB8XXX_FW_MAX_RETRY is 3. We were using a post-op loop
"while (retries--) {" but then the lines after that assume the loop
exits with retries set to zero.
I've fixed this by changing to a pre-op loop. I started with retries
set to 4 instead of 3 so that we still go through the loop the same
number of times.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell/mwifiex/usb.c')
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/usb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index cdd8f9a867a9..0857575c5c39 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -995,7 +995,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, { int ret = 0; u8 *firmware = fw->fw_buf, *recv_buff; - u32 retries = USB8XXX_FW_MAX_RETRY, dlen; + u32 retries = USB8XXX_FW_MAX_RETRY + 1; + u32 dlen; u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0; struct fw_data *fwdata; struct fw_sync_header sync_fw; @@ -1043,7 +1044,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, } /* If the send/receive fails or CRC occurs then retry */ - while (retries--) { + while (--retries) { u8 *buf = (u8 *)fwdata; u32 len = FW_DATA_XMIT_SIZE; @@ -1103,7 +1104,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, continue; } - retries = USB8XXX_FW_MAX_RETRY; + retries = USB8XXX_FW_MAX_RETRY + 1; break; } fw_seqnum++; |