From f91715438ad20dd71ec6bb6bb857e50da7d86602 Mon Sep 17 00:00:00 2001 From: Tuan PM Date: Wed, 7 Jun 2017 14:32:32 +0700 Subject: [PATCH] i2s: return error code if register isr error, resolve #587 (github) set p_i2s_obj = NULL when return error --- components/driver/i2s.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/driver/i2s.c b/components/driver/i2s.c index ac0c3fb07..f78745f32 100644 --- a/components/driver/i2s.c +++ b/components/driver/i2s.c @@ -868,8 +868,9 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, err = i2s_isr_register(i2s_num, i2s_config->intr_alloc_flags, i2s_intr_handler_default, p_i2s_obj[i2s_num], &p_i2s_obj[i2s_num]->i2s_isr_handle); if (err != ESP_OK) { free(p_i2s_obj[i2s_num]); + p_i2s_obj[i2s_num] = NULL; ESP_LOGE(I2S_TAG, "Register I2S Interrupt error"); - return ESP_FAIL; + return err; } i2s_stop(i2s_num); i2s_param_config(i2s_num, i2s_config);