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 6abcb68ca95f999f6ad23285b1eee6d4be85e8b8 Author: wangzhi16 <[email protected]> AuthorDate: Tue Sep 2 15:49:01 2025 +0800 mm/mempool: MISRA-C 2012 9.1, variables must be initialized before use Initialize semcount before nxsem_get_value() fills it in mempool_release() and mempool_info(), so that it has a value even if the call fails. Assisted-by: Kiro:claude-opus-5-5 Signed-off-by: wangzhi16 <[email protected]> --- mm/mempool/mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c index 97829430f48..5c2198e0dd0 100644 --- a/mm/mempool/mempool.c +++ b/mm/mempool/mempool.c @@ -607,7 +607,7 @@ void mempool_release(FAR struct mempool_s *pool, FAR void *blk) spin_unlock_irqrestore(&pool->lock, flags); if (mempool_can_wait(pool)) { - int semcount; + int semcount = 0; nxsem_get_value(&pool->waitsem, &semcount); if (semcount < 1) @@ -685,7 +685,7 @@ int mempool_info(FAR struct mempool_s *pool, FAR struct mempoolinfo_s *info) info->sizeblks = blocksize; if (mempool_can_wait(pool)) { - int semcount; + int semcount = 0; nxsem_get_value(&pool->waitsem, &semcount); info->nwaiter = -semcount;
