From 6d8320fd8c3e2a16d230774fb85ec93253065632 Mon Sep 17 00:00:00 2001 From: Kari Haapalehto Date: Tue, 4 Dec 2018 14:39:42 +0200 Subject: [PATCH] Coverity fixes. These issues has been found by coverity. --- .../mbed-mesh-api/source/ethernet_tasklet.c | 14 ++++++++++++-- .../nanostack/mbed-mesh-api/source/wisun_tasklet.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c b/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c index 818772ccba..7f9dfc68ae 100644 --- a/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c @@ -228,8 +228,18 @@ static void enet_tasklet_poll_network_status(void *param) */ void enet_tasklet_configure_and_connect_to_network(void) { - arm_nwk_interface_up(tasklet_data_ptr->network_interface_id); - enet_tasklet_network_state_changed(MESH_BOOTSTRAP_STARTED); + int8_t status; + + status = arm_nwk_interface_up(tasklet_data_ptr->network_interface_id); + if (status >= 0) { + tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_STARTED; + tr_info("Start Bootstrap"); + enet_tasklet_network_state_changed(MESH_BOOTSTRAP_STARTED); + } else { + tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_FAILED; + tr_err("Bootstrap start failed, %d", status); + enet_tasklet_network_state_changed(MESH_BOOTSTRAP_START_FAILED); + } } /* diff --git a/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c b/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c index 6cdec8aa59..9b751248cb 100644 --- a/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/wisun_tasklet.c @@ -256,7 +256,7 @@ int8_t wisun_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id re_connecting = false; } - memset(wisun_tasklet_data_ptr, 0, sizeof(wisun_tasklet_data_ptr)); + memset(wisun_tasklet_data_ptr, 0, sizeof(wisun_tasklet_data_str_t)); wisun_tasklet_data_ptr->mesh_api_cb = callback; wisun_tasklet_data_ptr->network_interface_id = nwk_interface_id; wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_INITIALIZED;