diff --git a/components/driver/twai/twai.c b/components/driver/twai/twai.c index b2d64cc433..b6ba2da450 100644 --- a/components/driver/twai/twai.c +++ b/components/driver/twai/twai.c @@ -547,8 +547,10 @@ esp_err_t twai_driver_install_v2(const twai_general_config_t *g_config, const tw .clock_source_hz = clock_source_hz, .controller_id = controller_id, }; - bool res = twai_hal_init(&p_twai_obj->hal, &hal_config); - assert(res); + if (twai_hal_init(&p_twai_obj->hal, &hal_config) == false) { + ret = ESP_ERR_INVALID_STATE; + goto err; + } twai_hal_configure(&p_twai_obj->hal, t_config, f_config, DRIVER_DEFAULT_INTERRUPTS, g_config->clkout_divider); //Assign GPIO and Interrupts