Commit 78aa20d8 authored by Javier Achirica's avatar Javier Achirica Committed by Jeff Garzik

[wireless airo] eliminate infinite loop

makes sure a possible (never happened, but just in case) infinite
loop in the transmission code terminates.
parent 1dc6ca07
...@@ -2726,6 +2726,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, ...@@ -2726,6 +2726,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
one for now. */ one for now. */
static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw) static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw)
{ {
unsigned int loop = 3000;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
u16 txFid; u16 txFid;
...@@ -2746,7 +2747,12 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw) ...@@ -2746,7 +2747,12 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw)
/* wait for the allocate event/indication /* wait for the allocate event/indication
* It makes me kind of nervous that this can just sit here and spin, * It makes me kind of nervous that this can just sit here and spin,
* but in practice it only loops like four times. */ * but in practice it only loops like four times. */
while ( (IN4500(ai, EVSTAT) & EV_ALLOC) == 0) ; while (((IN4500(ai, EVSTAT) & EV_ALLOC) == 0) && --loop);
if (!loop) {
txFid = ERROR;
goto done;
}
// get the allocated fid and acknowledge // get the allocated fid and acknowledge
txFid = IN4500(ai, TXALLOCFID); txFid = IN4500(ai, TXALLOCFID);
OUT4500(ai, EVACK, EV_ALLOC); OUT4500(ai, EVACK, EV_ALLOC);
......
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