Skip to content

Commit

Permalink
Bluetooth: Fix false errors from bcsp_pkt_cull function
Browse files Browse the repository at this point in the history
The error message "Removed only %u out of %u pkts" is printed when multiple
to be acked packets are queued.

    if (i++ >= pkts_to_be_removed)
            break;

This will break out of the loop and increase the counter i when
i==pkts_to_be_removed and the loop ends up with i=pkts_to_be_removed+1.

The following line

    if (i != pkts_to_be_removed) {
            BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
    }

will then display the false message.

The counter i must not increase on the same statement.

Signed-off-by: Wending Weng <wweng@rheinmetall.ca>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Wending Weng authored and Marcel Holtmann committed Aug 24, 2009
1 parent 1b7bf4e commit d2e353f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/bluetooth/hci_bcsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)

i = 0;
skb_queue_walk_safe(&bcsp->unack, skb, tmp) {
if (i++ >= pkts_to_be_removed)
if (i >= pkts_to_be_removed)
break;
i++;

__skb_unlink(skb, &bcsp->unack);
kfree_skb(skb);
Expand Down

0 comments on commit d2e353f

Please sign in to comment.