mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 20:24:32 +02:00
Fixed some memory was not released after bluetooth controller initialization failed on ESP32
This commit is contained in:
@@ -305,6 +305,8 @@ static uint8_t coex_schm_curr_period_get_wrapper(void);
|
|||||||
static void * coex_schm_curr_phase_get_wrapper(void);
|
static void * coex_schm_curr_phase_get_wrapper(void);
|
||||||
static int coex_wifi_channel_get_wrapper(uint8_t *primary, uint8_t *secondary);
|
static int coex_wifi_channel_get_wrapper(uint8_t *primary, uint8_t *secondary);
|
||||||
static int coex_register_wifi_channel_change_callback_wrapper(void *cb);
|
static int coex_register_wifi_channel_change_callback_wrapper(void *cb);
|
||||||
|
static void bt_controller_deinit_internal(void);
|
||||||
|
|
||||||
/* Local variable definition
|
/* Local variable definition
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -1317,30 +1319,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
#ifdef CONFIG_PM_ENABLE
|
|
||||||
if (!s_btdm_allow_light_sleep) {
|
|
||||||
if (s_light_sleep_pm_lock != NULL) {
|
|
||||||
esp_pm_lock_delete(s_light_sleep_pm_lock);
|
|
||||||
s_light_sleep_pm_lock = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (s_pm_lock != NULL) {
|
|
||||||
esp_pm_lock_delete(s_pm_lock);
|
|
||||||
s_pm_lock = NULL;
|
|
||||||
}
|
|
||||||
if (s_btdm_slp_tmr != NULL) {
|
|
||||||
esp_timer_delete(s_btdm_slp_tmr);
|
|
||||||
s_btdm_slp_tmr = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (s_wakeup_req_sem) {
|
|
||||||
semphr_delete_wrapper(s_wakeup_req_sem);
|
|
||||||
s_wakeup_req_sem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_bt_power_domain_off();
|
bt_controller_deinit_internal();
|
||||||
|
|
||||||
esp_phy_modem_deinit();
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,6 +1333,13 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
btdm_controller_deinit();
|
btdm_controller_deinit();
|
||||||
|
|
||||||
|
bt_controller_deinit_internal();
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bt_controller_deinit_internal(void)
|
||||||
|
{
|
||||||
periph_module_disable(PERIPH_BT_MODULE);
|
periph_module_disable(PERIPH_BT_MODULE);
|
||||||
|
|
||||||
#ifdef CONFIG_PM_ENABLE
|
#ifdef CONFIG_PM_ENABLE
|
||||||
@@ -1373,11 +1361,16 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
|
|
||||||
s_pm_lock_acquired = false;
|
s_pm_lock_acquired = false;
|
||||||
#endif
|
#endif
|
||||||
semphr_delete_wrapper(s_wakeup_req_sem);
|
|
||||||
s_wakeup_req_sem = NULL;
|
|
||||||
|
|
||||||
free(osi_funcs_p);
|
if (s_wakeup_req_sem) {
|
||||||
osi_funcs_p = NULL;
|
semphr_delete_wrapper(s_wakeup_req_sem);
|
||||||
|
s_wakeup_req_sem = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osi_funcs_p) {
|
||||||
|
free(osi_funcs_p);
|
||||||
|
osi_funcs_p = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
@@ -1387,8 +1380,6 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
esp_bt_power_domain_off();
|
esp_bt_power_domain_off();
|
||||||
|
|
||||||
esp_phy_modem_deinit();
|
esp_phy_modem_deinit();
|
||||||
|
|
||||||
return ESP_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bt_shutdown(void)
|
static void bt_shutdown(void)
|
||||||
|
Submodule components/bt/controller/lib_esp32 updated: dbaeb136ca...9c5686aaa3
Reference in New Issue
Block a user