Commit 06dfa999 authored by Mark Wang's avatar Mark Wang Committed by Henrik Brix Andersen
Browse files

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: default avatarMark Wang <yichang.wang@nxp.com>
parent 72c4af32
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -542,12 +542,12 @@ static int bt_a2dp_get_capabilities_cb(struct bt_avdtp_req *req, struct net_buf
	uint8_t codec_type;
	uint8_t user_ret;

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

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

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

	a2dp->peer_seps_count = 0U;

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