From 7c53e88b0586e36b15a7fe5c379d04bf1ab978f6 Mon Sep 17 00:00:00 2001 From: xiongweichao Date: Mon, 10 May 2021 11:11:02 +0800 Subject: [PATCH] Remove btc_hf_idx_by_bdaddr in both btc_hf_init and btc_hf_deinit functions --- .../host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c index 1eadb3924b..83f3b6691d 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c +++ b/components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c @@ -300,12 +300,15 @@ bt_status_t btc_hf_execute_service(BOOLEAN b_enable) ************************************************************************************/ bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr) { + int idx = 0; + UNUSED(bd_addr); + #if HFP_DYNAMIC_MEMORY == TRUE if ((hf_local_param = (hf_local_param_t *)osi_malloc(sizeof(hf_local_param_t) * BTC_HF_NUM_CB)) == NULL) { return BT_STATUS_FAIL; } #endif - int idx = btc_hf_idx_by_bdaddr(bd_addr); + BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients); /* Invoke the enable service API to the core to set the appropriate service_id * Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone) @@ -331,7 +334,8 @@ bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr) void btc_hf_deinit(bt_bdaddr_t *bd_addr) { - int idx = btc_hf_idx_by_bdaddr(bd_addr); + UNUSED(bd_addr); + BTC_TRACE_EVENT("%s", __FUNCTION__); btc_dm_disable_service(BTA_HFP_SERVICE_ID); #if HFP_DYNAMIC_MEMORY == TRUE @@ -340,7 +344,7 @@ void btc_hf_deinit(bt_bdaddr_t *bd_addr) hf_local_param = NULL; } #else - hf_local_param[idx].btc_hf_cb.initialized = false; + hf_local_param[0].btc_hf_cb.initialized = false; #endif }