From 596f94be06dc5bc1df4d7685be231a947e4665d9 Mon Sep 17 00:00:00 2001 From: Laurent Soest Date: Mon, 16 Feb 2026 10:28:30 +0100 Subject: [PATCH] create mutex before calling _ux_utility_memory_allocate When compiling with UX_ENABLE_DEBUG_LOG the call to _ux_utility_memory_allocate requires the system mutex. --- common/core/src/ux_system_initialize.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/core/src/ux_system_initialize.c b/common/core/src/ux_system_initialize.c index a3e27c47..443ee9a4 100644 --- a/common/core/src/ux_system_initialize.c +++ b/common/core/src/ux_system_initialize.c @@ -261,6 +261,14 @@ ULONG pool_size; /* Other fields are kept zero. */ #endif +#if !defined(UX_STANDALONE) + + /* Create the Mutex object used by USBX to control critical sections. */ + status = _ux_system_mutex_create(&_ux_system -> ux_system_mutex, "ux_system_mutex"); + if(status != UX_SUCCESS) + return(UX_MUTEX_ERROR); +#endif + #ifdef UX_ENABLE_DEBUG_LOG /* Obtain memory for storing the debug log. */ @@ -277,14 +285,6 @@ ULONG pool_size; #endif -#if !defined(UX_STANDALONE) - - /* Create the Mutex object used by USBX to control critical sections. */ - status = _ux_system_mutex_create(&_ux_system -> ux_system_mutex, "ux_system_mutex"); - if(status != UX_SUCCESS) - return(UX_MUTEX_ERROR); -#endif - return(UX_SUCCESS); }