Browse Source

still write handle on failed init

ugv_io
Alex Mikhalev 6 years ago
parent
commit
13e1c275fb
  1. 2
      components/sx127x_driver/sx127x_driver.c

2
components/sx127x_driver/sx127x_driver.c

@ -66,6 +66,7 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
esp_err_t ret; esp_err_t ret;
sx127x_t *hndl = malloc(sizeof(sx127x_t)); sx127x_t *hndl = malloc(sizeof(sx127x_t));
SX127X_CHECK(hndl != NULL, "malloc error", ESP_ERR_NO_MEM); SX127X_CHECK(hndl != NULL, "malloc error", ESP_ERR_NO_MEM);
*handle_ptr = hndl;
hndl->task_handle = NULL; hndl->task_handle = NULL;
atomic_init(&hndl->task_state, SX127X_TASK_STOPPED); atomic_init(&hndl->task_state, SX127X_TASK_STOPPED);
@ -122,7 +123,6 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
ret = sx127x_write_config(hndl); ret = sx127x_write_config(hndl);
SX127X_ERROR_CHECK(ret); SX127X_ERROR_CHECK(ret);
*handle_ptr = hndl;
return ESP_OK; return ESP_OK;
} }

Loading…
Cancel
Save