ble(fix): deinit crash issue

This commit is contained in:
luomanruo 2023-11-17 20:35:12 +08:00
parent 8f44bee739
commit b7b042f45d
5 changed files with 16 additions and 13 deletions

View File

@ -667,7 +667,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP #endif // CONFIG_BT_CONTROLLER_LOG_DUMP
if (ret != ESP_OK) { if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto modem_deint; goto controller_init_err;
} }
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
@ -691,11 +691,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
return ESP_OK; return ESP_OK;
free_controller: free_controller:
controller_sleep_deinit(); controller_sleep_deinit();
modem_deint:
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
controller_init_err:
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit(); ble_controller_deinit();
modem_deint:
esp_phy_modem_deinit(); esp_phy_modem_deinit();
periph_module_disable(PERIPH_BT_MODULE); periph_module_disable(PERIPH_BT_MODULE);
#if CONFIG_BT_NIMBLE_ENABLED #if CONFIG_BT_NIMBLE_ENABLED
@ -719,10 +720,10 @@ esp_err_t esp_bt_controller_deinit(void)
controller_sleep_deinit(); controller_sleep_deinit();
ble_controller_deinit();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit();
periph_module_disable(PERIPH_BT_MODULE); periph_module_disable(PERIPH_BT_MODULE);

View File

@ -794,7 +794,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP #endif // CONFIG_BT_CONTROLLER_LOG_DUMP
if (ret != ESP_OK) { if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto modem_deint; goto controller_init_err;
} }
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
@ -825,12 +825,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
free_controller: free_controller:
controller_sleep_deinit(); controller_sleep_deinit();
os_msys_deinit();
modem_deint:
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
controller_init_err:
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
os_msys_deinit();
ble_controller_deinit(); ble_controller_deinit();
modem_deint:
esp_phy_modem_deinit(); esp_phy_modem_deinit();
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE);
@ -861,10 +862,10 @@ esp_err_t esp_bt_controller_deinit(void)
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE);
ble_controller_deinit();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit();
#if CONFIG_BT_NIMBLE_ENABLED #if CONFIG_BT_NIMBLE_ENABLED
/* De-initialize default event queue */ /* De-initialize default event queue */

View File

@ -774,7 +774,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP #endif // CONFIG_BT_CONTROLLER_LOG_DUMP
if (ret != ESP_OK) { if (ret != ESP_OK) {
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret); ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
goto modem_deint; goto controller_init_err;
} }
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
@ -806,12 +806,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
free_controller: free_controller:
controller_sleep_deinit(); controller_sleep_deinit();
os_msys_deinit();
modem_deint:
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
controller_init_err:
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
os_msys_deinit();
ble_controller_deinit(); ble_controller_deinit();
modem_deint:
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE);
#if CONFIG_BT_NIMBLE_ENABLED #if CONFIG_BT_NIMBLE_ENABLED
@ -840,10 +841,10 @@ esp_err_t esp_bt_controller_deinit(void)
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE); modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
modem_clock_module_disable(PERIPH_BT_MODULE); modem_clock_module_disable(PERIPH_BT_MODULE);
ble_controller_deinit();
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_log_deinit_async(); ble_log_deinit_async();
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
ble_controller_deinit();
#if CONFIG_BT_NIMBLE_ENABLED #if CONFIG_BT_NIMBLE_ENABLED
/* De-initialize default event queue */ /* De-initialize default event queue */

@ -1 +1 @@
Subproject commit 932edd189ed4a39de19fb0e0dfc08b26b8785731 Subproject commit e70c4abbd5666afac3b7b3cea1c3d9c59ee33ce9

@ -1 +1 @@
Subproject commit 11aa66e7f39c9402039882acb14a993e390f8893 Subproject commit 66303b4a8cc8e889a0c9bdd7301582ba2cb8b0eb