diff --git a/components/bt/bluedroid/hci/hci_hal_h4.c b/components/bt/bluedroid/hci/hci_hal_h4.c index b9231b1b6f..f0769e02b9 100644 --- a/components/bt/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/bluedroid/hci/hci_hal_h4.c @@ -92,6 +92,7 @@ static void hci_hal_env_init( static void hci_hal_env_deinit(void) { fixed_queue_free(hci_hal_env.rx_q, hci_hal_env.allocator->free); + hci_hal_env.rx_q = NULL; } static bool hal_open(const hci_hal_callbacks_t *upper_callbacks) @@ -260,6 +261,10 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len) BT_HDR *pkt; size_t pkt_size; + if (hci_hal_env.rx_q == NULL) { + return 0; + } + pkt_size = BT_HDR_SIZE + len; pkt = (BT_HDR *)hci_hal_env.allocator->alloc(pkt_size); if (!pkt) { diff --git a/components/bt/bt.c b/components/bt/bt.c index 195758dc74..3e928af4fa 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -57,9 +57,9 @@ /* not for user call, so don't put to include file */ extern void btdm_osi_funcs_register(void *osi_funcs); extern int btdm_controller_init(uint32_t config_mask, esp_bt_controller_config_t *config_opts); -extern int btdm_controller_deinit(void); +extern void btdm_controller_deinit(void); extern int btdm_controller_enable(esp_bt_mode_t mode); -extern int btdm_controller_disable(esp_bt_mode_t mode); +extern void btdm_controller_disable(void); extern uint8_t btdm_controller_get_mode(void); extern const char *btdm_controller_get_compile_version(void); extern void btdm_rf_bb_init(void); @@ -748,9 +748,7 @@ esp_err_t esp_bt_controller_deinit(void) return ESP_ERR_INVALID_STATE; } - if (btdm_controller_deinit() != 0) { - return ESP_ERR_NO_MEM; - } + btdm_controller_deinit(); periph_module_disable(PERIPH_BT_MODULE); @@ -806,21 +804,14 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) esp_err_t esp_bt_controller_disable(void) { - int ret; - if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) { return ESP_ERR_INVALID_STATE; } - ret = btdm_controller_disable(btdm_controller_get_mode()); - if (ret < 0) { - return ESP_ERR_INVALID_STATE; - } + btdm_controller_disable(); - if (ret == ESP_BT_MODE_IDLE) { - esp_phy_rf_deinit(); - btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED; - } + esp_phy_rf_deinit(); + btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED; #ifdef CONFIG_PM_ENABLE esp_pm_lock_release(s_pm_lock); diff --git a/components/bt/lib b/components/bt/lib index 12ca65ce02..96e7e06e0b 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 12ca65ce02d292a6223cd8f658fb5c38638b2dd5 +Subproject commit 96e7e06e0bd602953b0a80531eaa4a7dc6cb935a