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:
Luiz Augusto von Dentz 2019-06-13 21:42:29 +03:00 committed by Johan Hedberg
commit a788ce23da

View file

@ -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;
} }