diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 5e53d09c4..0b177650a 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -6781,7 +6781,12 @@ ble_gap_init(void) memset(&ble_gap_sync, 0, sizeof(ble_gap_sync)); #endif - ble_npl_mutex_init(&preempt_done_mutex); + rc = ble_npl_mutex_init(&preempt_done_mutex); + + if (rc) { + BLE_HS_LOG(ERROR, "mutex init failed with reason %d \n", rc); + return rc; + } SLIST_INIT(&ble_gap_update_entries); SLIST_INIT(&ble_gap_event_listener_list); diff --git a/nimble/transport/src/monitor.c b/nimble/transport/src/monitor.c index 9b3a73470..b6daeec83 100644 --- a/nimble/transport/src/monitor.c +++ b/nimble/transport/src/monitor.c @@ -299,6 +299,7 @@ void ble_monitor_init(void) { SYSINIT_ASSERT_ACTIVE(); + ble_npl_error_t rc; #if MYNEWT_VAL(BLE_MONITOR_UART) struct uart_conf uc = { @@ -340,7 +341,8 @@ ble_monitor_init(void) SYSINIT_PANIC_ASSERT(rtt_index >= 0); #endif - ble_npl_mutex_init(&lock); + rc = ble_npl_mutex_init(&lock); + SYSINIT_PANIC_ASSERT(rc == 0); #if BLE_MONITOR ble_monitor_new_index(0, (uint8_t[6]){ }, "nimble0"); diff --git a/porting/nimble/src/nimble_port.c b/porting/nimble/src/nimble_port.c index 8131e313c..ec05897c1 100644 --- a/porting/nimble/src/nimble_port.c +++ b/porting/nimble/src/nimble_port.c @@ -211,7 +211,14 @@ int nimble_port_stop(void) { esp_err_t err = ESP_OK; - ble_npl_sem_init(&ble_hs_stop_sem, 0); + ble_npl_error_t rc; + + rc = ble_npl_sem_init(&ble_hs_stop_sem, 0); + + if( rc != 0) { + ESP_LOGE(NIMBLE_PORT_LOG_TAG, "sem init failed with reason: %d \n", rc); + return rc; + } /* Initiate a host stop procedure. */ err = ble_hs_stop(&stop_listener, ble_hs_stop_cb,