From 13e1c275fb68ed6b4695e2595258ad66fc8226e3 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Mon, 31 Dec 2018 14:06:21 -0700 Subject: [PATCH] still write handle on failed init --- components/sx127x_driver/sx127x_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/sx127x_driver/sx127x_driver.c b/components/sx127x_driver/sx127x_driver.c index ff771c9..bec3f3e 100644 --- a/components/sx127x_driver/sx127x_driver.c +++ b/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; sx127x_t *hndl = malloc(sizeof(sx127x_t)); SX127X_CHECK(hndl != NULL, "malloc error", ESP_ERR_NO_MEM); + *handle_ptr = hndl; hndl->task_handle = NULL; 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); SX127X_ERROR_CHECK(ret); - *handle_ptr = hndl; return ESP_OK; }