Bluetooth: L2CAP: Fix regression causing credits not to be restored

Patch 8c118f8673 causes the wrong semaphore
to checked so receiving credits are never restored which caused the
channel to get stuck after all the credits are consumed.

JIRA: ZEP-1199

Change-Id: I9cd5474b3bcaafcb19d15613939ce30d07befe0a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-11-06 17:06:23 +02:00 committed by Johan Hedberg
commit 4f39b4ceb1

View file

@ -1165,13 +1165,13 @@ static void l2cap_chan_update_credits(struct bt_l2cap_le_chan *chan)
uint16_t credits;
/* Only give more credits if it went bellow the defined threshold */
if (nano_sem_count_get(&chan->tx.credits) >
if (nano_sem_count_get(&chan->rx.credits) >
L2CAP_LE_CREDITS_THRESHOLD) {
goto done;
}
/* Restore credits */
credits = L2CAP_LE_MAX_CREDITS - nano_sem_count_get(&chan->tx.credits);
credits = L2CAP_LE_MAX_CREDITS - nano_sem_count_get(&chan->rx.credits);
l2cap_chan_rx_give_credits(chan, credits);
buf = bt_l2cap_create_pdu(&le_sig, 0);