Skip to content

Commit fd4cc0e

Browse files
PavelVPVkartben
authored andcommitted
bluetooth: host: att: Remove meaningless check
`>= 0` was used when EATT support was implemented (#23199) because `bt_l2cap_chan_send` could return number of bytes sent. After PR #67528, `bt_l2cap_chan_send` doesn't return amount of bytes sent or any positive value, but either 0 or negative value. Thus `>= 0` is not needed. It also confusing when reading code, especially when the same check is not implemented in other cases where underlying function `chan_send` is used. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent e53e4cf commit fd4cc0e

File tree

1 file changed

+5
-4
lines changed
  • subsys/bluetooth/host

1 file changed

+5
-4
lines changed

subsys/bluetooth/host/att.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ static void bt_att_sent(struct bt_l2cap_chan *ch)
584584
if (!chan->req && !sys_slist_is_empty(&att->reqs)) {
585585
sys_snode_t *node = sys_slist_get(&att->reqs);
586586

587-
if (bt_att_chan_req_send(chan, ATT_REQ(node)) >= 0) {
587+
err = bt_att_chan_req_send(chan, ATT_REQ(node));
588+
if (err == 0) {
588589
return;
589590
}
590591

@@ -664,7 +665,7 @@ static void att_on_sent_cb(struct bt_att_tx_meta_data *meta)
664665
}
665666

666667
if (!bt_att_is_enhanced(meta->att_chan)) {
667-
struct bt_att_chan *att_chan = meta->att_chan->att->conn;
668+
struct bt_att_chan *att_chan = meta->att_chan;
668669
struct bt_conn *conn = att_chan->att->conn;
669670
struct bt_l2cap_chan *l2cap_chan = &att_chan->chan.chan;
670671

@@ -919,7 +920,7 @@ static void att_req_send_process(struct bt_att *att)
919920
continue;
920921
}
921922

922-
if (bt_att_chan_req_send(chan, req) >= 0) {
923+
if (bt_att_chan_req_send(chan, req) == 0) {
923924
return;
924925
}
925926

@@ -3346,7 +3347,7 @@ static void bt_att_status(struct bt_l2cap_chan *ch, atomic_t *status)
33463347
return;
33473348
}
33483349

3349-
if (bt_att_chan_req_send(chan, ATT_REQ(node)) >= 0) {
3350+
if (bt_att_chan_req_send(chan, ATT_REQ(node)) == 0) {
33503351
return;
33513352
}
33523353

0 commit comments

Comments
 (0)