diff --git a/components/bootloader_support/src/bootloader_sha.c b/components/bootloader_support/src/bootloader_sha.c index 7826656..b1d00b3 100644 --- a/components/bootloader_support/src/bootloader_sha.c +++ b/components/bootloader_support/src/bootloader_sha.c @@ -33,7 +33,8 @@ bootloader_sha256_handle_t bootloader_sha256_start() return NULL; } mbedtls_sha256_init(ctx); - assert(mbedtls_sha256_starts_ret(ctx, false) == 0); + int res = mbedtls_sha256_starts_ret(ctx, false); + assert(res == 0); return ctx; } @@ -41,7 +42,8 @@ void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, { assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; - assert(mbedtls_sha256_update_ret(ctx, data, data_len) == 0); + int res = mbedtls_sha256_update_ret(ctx, data, data_len); + assert(res == 0); } void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest) @@ -49,7 +51,8 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; if (digest != NULL) { - assert(mbedtls_sha256_finish_ret(ctx, digest) == 0); + int res = mbedtls_sha256_finish_ret(ctx, digest); + assert(res == 0); } mbedtls_sha256_free(ctx); free(handle); @@ -191,7 +194,8 @@ bootloader_sha256_handle_t bootloader_sha256_start() return NULL; } mbedtls_sha256_init(ctx); - assert(mbedtls_sha256_starts_ret(ctx, false) == 0); + int res = mbedtls_sha256_starts_ret(ctx, false); + assert(res == 0); return ctx; } @@ -199,7 +203,8 @@ void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, { assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; - assert(mbedtls_sha256_update_ret(ctx, data, data_len) == 0); + int res = mbedtls_sha256_update_ret(ctx, data, data_len); + assert(res == 0); } void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest) @@ -207,7 +212,8 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; if (digest != NULL) { - assert(mbedtls_sha256_finish_ret(ctx, digest) == 0); + int res = mbedtls_sha256_finish_ret(ctx, digest); + assert(res == 0); } mbedtls_sha256_free(ctx); free(handle); diff --git a/components/esp8266/source/startup.c b/components/esp8266/source/startup.c index b9e582c..ab7c34f 100644 --- a/components/esp8266/source/startup.c +++ b/components/esp8266/source/startup.c @@ -69,10 +69,12 @@ static void user_init_entry(void *param) func[0](); esp_phy_init_clk(); - assert(base_gpio_init() == 0); + int err = base_gpio_init(); + assert(err == 0); if (esp_reset_reason_early() != ESP_RST_FAST_SW) { - assert(esp_mac_init() == ESP_OK); + err = esp_mac_init(); + assert(err == ESP_OK); } #if CONFIG_RESET_REASON @@ -83,7 +85,8 @@ static void user_init_entry(void *param) esp_task_wdt_init(); #endif - assert(esp_pthread_init() == 0); + err = esp_pthread_init(); + assert(err == 0); #ifdef CONFIG_BOOTLOADER_FAST_BOOT REG_CLR_BIT(DPORT_CTL_REG, DPORT_CTL_DOUBLE_CLK); @@ -101,6 +104,7 @@ static void user_init_entry(void *param) void call_start_cpu(size_t start_addr) { int i; + int err; int *p; extern int _bss_start, _bss_end; @@ -160,12 +164,15 @@ void call_start_cpu(size_t start_addr) #ifdef CONFIG_INIT_OS_BEFORE_START extern int __esp_os_init(void); - assert(__esp_os_init() == 0); + err = __esp_os_init(); + assert(err == 0); #endif - assert(esp_newlib_init() == 0); + err = esp_newlib_init(); + assert(err == 0); - assert(xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL) == pdPASS); + err = xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL); + assert(err == pdPASS); vTaskStartScheduler(); } diff --git a/components/esp_ringbuf/ringbuf.c b/components/esp_ringbuf/ringbuf.c index fb6bc07..10b57bd 100644 --- a/components/esp_ringbuf/ringbuf.c +++ b/components/esp_ringbuf/ringbuf.c @@ -1063,7 +1063,8 @@ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHan xReturn = xQueueAddToSet(pxRingbuffer->xItemsBufferedSemaphore, xQueueSet); if (xHoldSemaphore == pdTRUE) { //Return semaphore if temporarily held - configASSERT(xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore) == pdTRUE); + int res = xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore); + configASSERT(res == pdTRUE); } taskEXIT_CRITICAL(); return xReturn; @@ -1089,7 +1090,8 @@ BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t xRingbuffer, QueueS xReturn = xQueueRemoveFromSet(pxRingbuffer->xItemsBufferedSemaphore, xQueueSet); if (xHoldSemaphore == pdTRUE) { //Return semaphore if temporarily held - configASSERT(xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore) == pdTRUE); + int res = xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore); + configASSERT(res == pdTRUE); } taskEXIT_CRITICAL(); return xReturn; @@ -1157,7 +1159,8 @@ BaseType_t xRingbufferAddToQueueSetWrite(RingbufHandle_t xRingbuffer, QueueSetHa xReturn = xQueueAddToSet(pxRingbuffer->xFreeSpaceSemaphore, xQueueSet); if (xHoldSemaphore == pdTRUE) { //Return semaphore is temporarily held - configASSERT(xSemaphoreGive(pxRingbuffer->xFreeSpaceSemaphore) == pdTRUE); + int res = xSemaphoreGive(pxRingbuffer->xFreeSpaceSemaphore); + configASSERT(res == pdTRUE); } portEXIT_CRITICAL(); return xReturn; @@ -1176,7 +1179,8 @@ BaseType_t xRingbufferRemoveFromQueueSetWrite(RingbufHandle_t xRingbuffer, Queue xReturn = xQueueRemoveFromSet(pxRingbuffer->xFreeSpaceSemaphore, xQueueSet); if (xHoldSemaphore == pdTRUE) { //Return semaphore is temporarily held - configASSERT(xSemaphoreGive(pxRingbuffer->xFreeSpaceSemaphore) == pdTRUE); + int res = xSemaphoreGive(pxRingbuffer->xFreeSpaceSemaphore); + configASSERT(res == pdTRUE); } portEXIT_CRITICAL(); return xReturn; diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index 6d9e69e..bbb22b7 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -35,8 +35,13 @@ #define WIFI_PROV_MGR_VERSION "v1.1" #define MAX_SCAN_RESULTS CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES +#ifndef NDEBUG #define ACQUIRE_LOCK(mux) assert(xSemaphoreTake(mux, portMAX_DELAY) == pdTRUE) #define RELEASE_LOCK(mux) assert(xSemaphoreGive(mux) == pdTRUE) +#else +#define ACQUIRE_LOCK(mux) xSemaphoreTake(mux, portMAX_DELAY); +#define RELEASE_LOCK(mux) xSemaphoreGive(mux); +#endif static const char *TAG = "wifi_prov_mgr"; @@ -621,8 +626,9 @@ static bool wifi_prov_mgr_stop_service(bool blocking) * released - some duration after - returning from a call to * wifi_prov_mgr_stop_provisioning(), like when it is called * inside a protocomm handler */ - assert(xTaskCreate(prov_stop_task, "prov_stop_task", 4096, (void *)1, - tskIDLE_PRIORITY, NULL) == pdPASS); + int res = xTaskCreate(prov_stop_task, "prov_stop_task", 4096, (void *)1, + tskIDLE_PRIORITY, NULL); + assert(res == pdPASS); ESP_LOGD(TAG, "Provisioning scheduled for stopping"); } return true;