kopia lustrzana https://github.com/espressif/esp-idf
Fixed some memory was not released after bluetooth controller initialization failed on ESP32
rodzic
76eb67253d
commit
3425d4df52
|
@ -305,6 +305,8 @@ static uint8_t coex_schm_curr_period_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_register_wifi_channel_change_callback_wrapper(void *cb);
|
||||
static void bt_controller_deinit_internal(void);
|
||||
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
|
@ -1317,30 +1319,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||
return ESP_OK;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1352,6 +1333,13 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||
|
||||
btdm_controller_deinit();
|
||||
|
||||
bt_controller_deinit_internal();
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void bt_controller_deinit_internal(void)
|
||||
{
|
||||
periph_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
|
@ -1373,11 +1361,16 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||
|
||||
s_pm_lock_acquired = false;
|
||||
#endif
|
||||
semphr_delete_wrapper(s_wakeup_req_sem);
|
||||
s_wakeup_req_sem = NULL;
|
||||
|
||||
free(osi_funcs_p);
|
||||
osi_funcs_p = NULL;
|
||||
if (s_wakeup_req_sem) {
|
||||
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;
|
||||
|
||||
|
@ -1387,8 +1380,6 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||
esp_bt_power_domain_off();
|
||||
|
||||
esp_phy_modem_deinit();
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void bt_shutdown(void)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit dbaeb136cacf8c7d071f838c1053f90299f57720
|
||||
Subproject commit 9c5686aaa35436d255459312b14fb0da339c656a
|
Ładowanie…
Reference in New Issue