This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c6357c3932640861e21eba1b50ac65867a4eb701
Author: wangzhi16 <[email protected]>
AuthorDate: Tue Sep 2 15:56:48 2025 +0800

    mm/mempool: Avoid using global variables.
    
    According to MISRA-C2012 8.9, An object should be defined at block scope if 
its identifier only appears in a single function
    
    Signed-off-by: wangzhi16 <[email protected]>
---
 mm/mempool/mempool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c
index 5c2198e0dd0..3639f993b9b 100644
--- a/mm/mempool/mempool.c
+++ b/mm/mempool/mempool.c
@@ -59,8 +59,6 @@ typedef void (*mempool_callback_t)(FAR struct mempool_s *pool,
  * Private Data
  ****************************************************************************/
 
-static mutex_t g_mempool_init_lock = NXMUTEX_INITIALIZER;
-
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -331,6 +329,7 @@ static void mempool_check_callback(FAR struct mempool_s 
*pool,
 
 int mempool_init(FAR struct mempool_s *pool)
 {
+  static mutex_t g_mempool_init_lock = NXMUTEX_INITIALIZER;
   size_t blocksize = MEMPOOL_REALBLOCKSIZE(pool->blocksize);
 
   if (pool->init)

Reply via email to