still write handle on failed init
This commit is contained in:
parent
33bb813a02
commit
13e1c275fb
@ -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…
x
Reference in New Issue
Block a user