From d8c732130428e3b52c32faad313266b408955554 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sun, 3 Nov 2024 20:01:50 +0100 Subject: [PATCH] kernel: fix asserts in kcond_wait and kcond_wait_timeout --- src/kernel/kernel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index ed1ee452e..89d068f02 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -910,7 +910,7 @@ void kcond_wait(kcond_t *cond, kmutex_t *mutex) disable_interrupts(); if (mutex) { assertf(mutex->owner == PhysicalAddr(th), "kcond_wait() called, but mutex is not locked by %s[%p]", th->name, th); - assertf(mutex->counter != 1, "kcond_wait() called, but mutex is locked multiple times"); + assertf(mutex->counter == 1, "kcond_wait() called, but mutex is locked multiple times"); // Unlock the mutex, and put the thread in the cond waiting list kmutex_unlock_internal(mutex); @@ -932,7 +932,7 @@ bool kcond_wait_timeout(kcond_t *cond, kmutex_t *mutex, uint32_t ticks) disable_interrupts(); assertf(mutex->owner == PhysicalAddr(th), "kcond_wait_timeout() called, but mutex is not locked by %s[%p]", th->name, th); - assertf(mutex->counter != 1, "kcond_wait_timeout() called, but mutex is locked multiple times"); + assertf(mutex->counter == 1, "kcond_wait_timeout() called, but mutex is locked multiple times"); // Unlock the mutex, and put the thread in the cond waiting list kmutex_unlock_internal(mutex);