diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index a0af304fc3..b4d6868927 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -669,7 +669,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) #endif // CONFIG_BT_CONTROLLER_LOG_DUMP if (ret != ESP_OK) { 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 @@ -693,11 +693,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) return ESP_OK; free_controller: controller_sleep_deinit(); -modem_deint: #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED +controller_init_err: ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_controller_deinit(); +modem_deint: esp_phy_modem_deinit(); periph_module_disable(PERIPH_BT_MODULE); #if CONFIG_BT_NIMBLE_ENABLED @@ -721,10 +722,10 @@ esp_err_t esp_bt_controller_deinit(void) controller_sleep_deinit(); - ble_controller_deinit(); #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED ble_log_deinit_async(); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED + ble_controller_deinit(); periph_module_disable(PERIPH_BT_MODULE);