drivers: esp32: wifi/bt: modify init call return error
Update both Wi-FI and BLE init codes to return proper error code and logging when it is missing heap. Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
This commit is contained in:
parent
5e225e0c8b
commit
882ac1d088
2 changed files with 15 additions and 6 deletions
|
|
@ -289,15 +289,19 @@ static int bt_esp32_ble_init(void)
|
|||
#endif
|
||||
|
||||
ret = esp_bt_controller_init(&bt_cfg);
|
||||
if (ret) {
|
||||
LOG_ERR("Bluetooth controller init failed %d", ret);
|
||||
return ret;
|
||||
if (ret == ESP_ERR_NO_MEM) {
|
||||
LOG_ERR("Not enough memory to initialize Bluetooth.");
|
||||
LOG_ERR("Consider increasing CONFIG_HEAP_MEM_POOL_SIZE value.");
|
||||
return -ENOMEM;
|
||||
} else if (ret != ESP_OK) {
|
||||
LOG_ERR("Unable to initialize the Bluetooth: %d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = esp_bt_controller_enable(mode);
|
||||
if (ret) {
|
||||
LOG_ERR("Bluetooth controller enable failed: %d", ret);
|
||||
return ret;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
esp_vhci_host_register_callback(&vhci_host_cb);
|
||||
|
|
|
|||
|
|
@ -874,8 +874,13 @@ static int esp32_wifi_dev_init(const struct device *dev)
|
|||
wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_err_t ret = esp_wifi_init(&config);
|
||||
|
||||
if (ret != ESP_OK) {
|
||||
LOG_ERR("Unable to initialize the wifi");
|
||||
if (ret == ESP_ERR_NO_MEM) {
|
||||
LOG_ERR("Not enough memory to initialize Wi-Fi.");
|
||||
LOG_ERR("Consider increasing CONFIG_HEAP_MEM_POOL_SIZE value.");
|
||||
return -ENOMEM;
|
||||
} else if (ret != ESP_OK) {
|
||||
LOG_ERR("Unable to initialize the Wi-Fi: %d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue