Bluetooth: ATT: Fix unbalanced use of k_sem_give
k_sem_give shall only be used if no callback has been set otherwise k_sem_take was not called which can break the flow control. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
ec89ae6ff4
commit
a788ce23da
1 changed files with 3 additions and 1 deletions
|
@ -2267,7 +2267,9 @@ int bt_att_send(struct bt_conn *conn, struct net_buf *buf, bt_conn_tx_cb_t cb,
|
||||||
|
|
||||||
err = att_send(conn, buf, cb, user_data);
|
err = att_send(conn, buf, cb, user_data);
|
||||||
if (err) {
|
if (err) {
|
||||||
k_sem_give(&att->tx_sem);
|
if (!cb) {
|
||||||
|
k_sem_give(&att->tx_sem);
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue