From 1c9712aa2a08bb6fa29f85089e8acc52d323bd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Fri, 5 Mar 2021 20:00:16 +0000 Subject: [PATCH] include: sys: Simplify sys_mutex_unlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant if() statements that are already included with k_mutex_unlock() Relates to issue #32994 Signed-off-by: Guðni Már Gilbert --- include/sys/mutex.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/sys/mutex.h b/include/sys/mutex.h index ab98a5490b3..29d7aee160d 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -156,16 +156,7 @@ static inline int sys_mutex_lock(struct sys_mutex *mutex, k_timeout_t timeout) static inline int sys_mutex_unlock(struct sys_mutex *mutex) { - if (mutex->kernel_mutex.lock_count == 0) { - return -EINVAL; - } - - if (mutex->kernel_mutex.owner != _current) { - return -EPERM; - } - - k_mutex_unlock(&mutex->kernel_mutex); - return 0; + return k_mutex_unlock(&mutex->kernel_mutex); } #endif /* CONFIG_USERSPACE */