posix: semaphore: check return value of k_mutex_lock()

This fixes CID 340851.

This should never fail, but it's also something that can be
easily verified.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
Christopher Friedt 2024-02-02 19:22:01 -05:00 committed by David Leach
parent b320899663
commit ba639ed6a8

View file

@ -26,7 +26,9 @@ static K_MUTEX_DEFINE(nsem_mutex);
static inline void nsem_list_lock(void)
{
k_mutex_lock(&nsem_mutex, K_FOREVER);
__unused int ret = k_mutex_lock(&nsem_mutex, K_FOREVER);
__ASSERT(ret == 0, "nsem_list_lock() failed: %d", ret);
}
static inline void nsem_list_unlock(void)