Skip to content

Commit

Permalink
Bluetooth: Refactor loop in l2cap_retransmit_one_frame
Browse files Browse the repository at this point in the history
This make it easier to see what is the real reason for loop to exit.
skb_queue_next return valid skb or garbage, not NULL.

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Szymon Janc authored and Gustavo F. Padovan committed Nov 16, 2011
1 parent 039d957 commit d1726b6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,12 @@ static void l2cap_retransmit_one_frame(struct l2cap_chan *chan, u16 tx_seq)
if (!skb)
return;

do {
if (bt_cb(skb)->tx_seq == tx_seq)
break;

while (bt_cb(skb)->tx_seq != tx_seq) {
if (skb_queue_is_last(&chan->tx_q, skb))
return;

} while ((skb = skb_queue_next(&chan->tx_q, skb)));
skb = skb_queue_next(&chan->tx_q, skb);
}

if (chan->remote_max_tx &&
bt_cb(skb)->retries == chan->remote_max_tx) {
Expand Down

0 comments on commit d1726b6

Please sign in to comment.