Commit 039d9572 authored by Szymon Janc's avatar Szymon Janc Committed by Gustavo F. Padovan

Bluetooth: Simplify l2cap_add_to_srej_queue

Make it easier to see what is loop break condition.
skb_queue_next return valid skb or garbage, not NULL.
Signed-off-by: default avatarSzymon Janc <szymon.janc@tieto.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent aef89f21
...@@ -3562,14 +3562,10 @@ static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb, ...@@ -3562,14 +3562,10 @@ static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb,
bt_cb(skb)->sar = sar; bt_cb(skb)->sar = sar;
next_skb = skb_peek(&chan->srej_q); next_skb = skb_peek(&chan->srej_q);
if (!next_skb) {
__skb_queue_tail(&chan->srej_q, skb);
return 0;
}
tx_seq_offset = __seq_offset(chan, tx_seq, chan->buffer_seq); tx_seq_offset = __seq_offset(chan, tx_seq, chan->buffer_seq);
do { while (next_skb) {
if (bt_cb(next_skb)->tx_seq == tx_seq) if (bt_cb(next_skb)->tx_seq == tx_seq)
return -EINVAL; return -EINVAL;
...@@ -3582,9 +3578,10 @@ static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb, ...@@ -3582,9 +3578,10 @@ static int l2cap_add_to_srej_queue(struct l2cap_chan *chan, struct sk_buff *skb,
} }
if (skb_queue_is_last(&chan->srej_q, next_skb)) if (skb_queue_is_last(&chan->srej_q, next_skb))
break; next_skb = NULL;
else
} while ((next_skb = skb_queue_next(&chan->srej_q, next_skb))); next_skb = skb_queue_next(&chan->srej_q, next_skb);
}
__skb_queue_tail(&chan->srej_q, skb); __skb_queue_tail(&chan->srej_q, skb);
......
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