Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2e353f7 authored by Wending Weng's avatar Wending Weng Committed by Marcel Holtmann
Browse files

Bluetooth: Fix false errors from bcsp_pkt_cull function



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: default avatarWending Weng <wweng@rheinmetall.ca>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 1b7bf4ed
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -373,8 +373,9 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp)


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


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