Skip to content

Commit

Permalink
Bluetooth: ATT: Fix using of k_fifo_{put,get}
Browse files Browse the repository at this point in the history
These functions don't work with buffers that do have fragments, instead
this replaces their usage with net_buf_{put,get}.

Signed-off-by: Luiz Augusto von Dentz <[email protected]>
  • Loading branch information
Vudentz authored and joerchan committed Jun 18, 2020
1 parent 4d79f99 commit 9d5146a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions subsys/bluetooth/host/att.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ static void bt_att_chan_send_rsp(struct bt_att_chan *chan, struct net_buf *buf,
err = bt_att_chan_send(chan, buf, cb);
if (err) {
/* Responses need to be sent back using the same channel */
k_fifo_put(&chan->tx_queue, buf);
net_buf_put(&chan->tx_queue, buf);
}
}

Expand Down Expand Up @@ -2499,12 +2499,12 @@ static void att_reset(struct bt_att *att)

#if CONFIG_BT_ATT_PREPARE_COUNT > 0
/* Discard queued buffers */
while ((buf = k_fifo_get(&att->prep_queue, K_NO_WAIT))) {
while ((buf = net_buf_get(&att->prep_queue, K_NO_WAIT))) {
net_buf_unref(buf);
}
#endif /* CONFIG_BT_ATT_PREPARE_COUNT > 0 */

while ((buf = k_fifo_get(&att->tx_queue, K_NO_WAIT))) {
while ((buf = net_buf_get(&att->tx_queue, K_NO_WAIT))) {
net_buf_unref(buf);
}

Expand Down Expand Up @@ -2538,7 +2538,7 @@ static void att_chan_detach(struct bt_att_chan *chan)
}

/* Release pending buffers */
while ((buf = k_fifo_get(&chan->tx_queue, K_NO_WAIT))) {
while ((buf = net_buf_get(&chan->tx_queue, K_NO_WAIT))) {
net_buf_unref(buf);
}

Expand Down Expand Up @@ -2969,7 +2969,7 @@ int bt_att_send(struct bt_conn *conn, struct net_buf *buf, bt_conn_tx_cb_t cb,
if (ret < 0) {
/* Queue buffer to be send later */
BT_DBG("Queueing buffer %p", buf);
k_fifo_put(&att->tx_queue, buf);
net_buf_put(&att->tx_queue, buf);
}

return 0;
Expand Down

0 comments on commit 9d5146a

Please sign in to comment.