Fixed incorrect parameters in switching to BTC context

pull/6808/head
xiongweichao 2022-10-19 16:17:08 +08:00
rodzic 3268075231
commit 592675fd5b
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -239,6 +239,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
bt_status_t ret;
// arg XOR arg_len
if ((msg == NULL) || ((arg == NULL) == !(arg_len == 0))) {
BTC_TRACE_WARNING("%s Invalid parameters\n", __func__);
return BT_STATUS_PARM_INVALID;
}
@ -246,6 +247,7 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
lmsg = (btc_msg_t *)osi_malloc(sizeof(btc_msg_t) + arg_len);
if (lmsg == NULL) {
BTC_TRACE_WARNING("%s No memory\n", __func__);
return BT_STATUS_NOMEM;
}

Wyświetl plik

@ -51,7 +51,7 @@ esp_err_t esp_hf_ag_init(void)
msg.act = BTC_HF_INIT_EVT;
/* Switch to BTC context */
bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL, NULL);
bt_status_t status = btc_transfer_context(&msg, NULL, 0, NULL, NULL);
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}
@ -66,7 +66,7 @@ esp_err_t esp_hf_ag_deinit(void)
msg.act = BTC_HF_DEINIT_EVT;
/* Switch to BTC context */
bt_status_t status = btc_transfer_context(&msg, NULL, sizeof(btc_hf_args_t), NULL, NULL);
bt_status_t status = btc_transfer_context(&msg, NULL, 0, NULL, NULL);
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}