Skip to content

Commit

Permalink
wl1271: fix timeout in wl1271_top_reg_read
Browse files Browse the repository at this point in the history
I noticed a timeout bug in

/drivers/net/wireless/wl12xx/wl1271_spi.c

In the current code you cannot tell why you exited
the "poll for data ready" do-while loop if exiting
was done after the last possible loop.

Then timeout==0 regardless of (val & OCP_READY_MASK) or
!(val & OCP_READY_MASK), leading to possible false timeout...

Simple correction could be decreasing timeout after checking
for !(val & OCP_READY_MASK), not before

(Manually converted from email to an actual patch by me. -- JWL)

Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Juha Leppanen authored and John W. Linville committed Jan 4, 2010
1 parent 891dc5e commit 5163363
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/wl12xx/wl1271_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ u16 wl1271_top_reg_read(struct wl1271 *wl, int addr)
/* poll for data ready */
do {
val = wl1271_spi_read32(wl, OCP_DATA_READ);
timeout--;
} while (!(val & OCP_READY_MASK) && timeout);
} while (!(val & OCP_READY_MASK) && --timeout);

if (!timeout) {
wl1271_warning("Top register access timed out.");
Expand Down

0 comments on commit 5163363

Please sign in to comment.