include: sys: Simplify sys_mutex_unlock

Remove redundant if() statements that are already included with
k_mutex_unlock()

Relates to issue #32994

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
This commit is contained in:
Guðni Már Gilbert 2021-03-05 20:00:16 +00:00 committed by Anas Nashif
commit 1c9712aa2a

View file

@ -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) static inline int sys_mutex_unlock(struct sys_mutex *mutex)
{ {
if (mutex->kernel_mutex.lock_count == 0) { return k_mutex_unlock(&mutex->kernel_mutex);
return -EINVAL;
}
if (mutex->kernel_mutex.owner != _current) {
return -EPERM;
}
k_mutex_unlock(&mutex->kernel_mutex);
return 0;
} }
#endif /* CONFIG_USERSPACE */ #endif /* CONFIG_USERSPACE */