Skip to content

Commit 06dfa99

Browse files
MarkWangChinesehenrikbrixandersen
authored andcommitted
bluetooth: a2dp: fix the process of failed cmd
If the cmd fail to receive response (for example: timeout), the buf is NULL, then need to callback the result. Signed-off-by: Mark Wang <[email protected]>
1 parent 72c4af3 commit 06dfa99

File tree

1 file changed

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

1 file changed

+4
-4
lines changed

subsys/bluetooth/host/classic/a2dp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,12 @@ static int bt_a2dp_get_capabilities_cb(struct bt_avdtp_req *req, struct net_buf
542542
uint8_t codec_type;
543543
uint8_t user_ret;
544544

545-
if (GET_CAP_REQ(req) != &a2dp->get_capabilities_param || buf == NULL) {
545+
if (GET_CAP_REQ(req) != &a2dp->get_capabilities_param) {
546546
return -EINVAL;
547547
}
548548

549549
LOG_DBG("GET CAPABILITIES result:%d", req->status);
550-
if (req->status) {
550+
if ((req->status != 0) || (buf == NULL)) {
551551
if ((a2dp->discover_cb_param != NULL) && (a2dp->discover_cb_param->cb != NULL)) {
552552
a2dp->discover_cb_param->cb(a2dp, NULL, NULL);
553553
a2dp->discover_cb_param = NULL;
@@ -651,13 +651,13 @@ static int bt_a2dp_discover_cb(struct bt_avdtp_req *req, struct net_buf *buf)
651651
int err;
652652

653653
LOG_DBG("DISCOVER result:%d", req->status);
654-
if (a2dp->discover_cb_param == NULL || buf == NULL) {
654+
if (a2dp->discover_cb_param == NULL) {
655655
return -EINVAL;
656656
}
657657

658658
a2dp->peer_seps_count = 0U;
659659

660-
if (!(req->status)) {
660+
if ((req->status == 0) && (buf != NULL)) {
661661
if (a2dp->discover_cb_param->sep_count == 0) {
662662
if (a2dp->discover_cb_param->cb != NULL) {
663663
a2dp->discover_cb_param->cb(a2dp, NULL, NULL);

0 commit comments

Comments
 (0)