Commit 91fe9ca7 authored by Pavel Roskin's avatar Pavel Roskin Committed by John W. Linville
Browse files

orinoco: correct timeout logic in __orinoco_hw_set_tkip_key()

If the value read from HERMES_RID_TXQUEUEEMPTY becomes 0 after exactly
100 readings, we wrongly consider it a timeout.  Rewrite the clever
while loop as a for loop that does the right thing and looks simpler.

Reported by Juha Leppanen <>
Signed-off-by: default avatarPavel Roskin <>
Signed-off-by: default avatarJohn W. Linville <>
parent 23a99840
......@@ -372,15 +372,13 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
/* Wait upto 100ms for tx queue to empty */
k = 100;
do {
for (k = 100; k > 0; k--) {
ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
if (ret)
if (ret || !xmitting)
} while ((k > 0) && xmitting);
if (k == 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment