diff --git a/kernel/include/ksched.h b/kernel/include/ksched.h index c7c927ef377..f38b21abbe7 100644 --- a/kernel/include/ksched.h +++ b/kernel/include/ksched.h @@ -87,7 +87,7 @@ static inline bool z_is_idle_thread(void *entry_point) static inline bool z_is_thread_pending(struct k_thread *thread) { - return !!(thread->base.thread_state & _THREAD_PENDING); + return (thread->base.thread_state & _THREAD_PENDING) != 0; } static inline bool z_is_thread_prevented_from_running(struct k_thread *thread) @@ -117,7 +117,7 @@ static inline bool z_has_thread_started(struct k_thread *thread) static inline bool z_is_thread_state_set(struct k_thread *thread, u32_t state) { - return !!(thread->base.thread_state & state); + return (thread->base.thread_state & state) != 0; } static inline bool z_is_thread_queued(struct k_thread *thread) diff --git a/kernel/msg_q.c b/kernel/msg_q.c index 460c05c9db4..b796e74db9b 100644 --- a/kernel/msg_q.c +++ b/kernel/msg_q.c @@ -101,7 +101,7 @@ Z_SYSCALL_HANDLER(k_msgq_alloc_init, q, msg_size, max_msgs) void k_msgq_cleanup(struct k_msgq *q) { - __ASSERT_NO_MSG(!z_waitq_head(&q->wait_q)); + __ASSERT_NO_MSG(z_waitq_head(&q->wait_q) == NULL); if ((q->flags & K_MSGQ_FLAG_ALLOC) != 0) { k_free(q->buffer_start); diff --git a/kernel/sched.c b/kernel/sched.c index 01f659a305f..1c28eb688e7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -73,9 +73,9 @@ static inline int is_metairq(struct k_thread *thread) } #if CONFIG_ASSERT -static inline int is_thread_dummy(struct k_thread *thread) +static inline bool is_thread_dummy(struct k_thread *thread) { - return !!(thread->base.thread_state & _THREAD_DUMMY); + return (thread->base.thread_state & _THREAD_DUMMY) != 0; } #endif diff --git a/kernel/timeout.c b/kernel/timeout.c index d4f85b0cddf..a24f0b4b6e4 100644 --- a/kernel/timeout.c +++ b/kernel/timeout.c @@ -12,7 +12,7 @@ #define LOCKED(lck) for (k_spinlock_key_t __i = {}, \ __key = k_spin_lock(lck); \ - !__i.key; \ + __i.key == 0; \ k_spin_unlock(lck, __key), __i.key = 1) static u64_t curr_tick; diff --git a/kernel/userspace.c b/kernel/userspace.c index 77dbe150301..a39f41df57b 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -558,19 +558,19 @@ int z_object_validate(struct _k_object *ko, enum k_objects otype, /* Manipulation of any kernel objects by a user thread requires that * thread be granted access first, even for uninitialized objects */ - if (unlikely(!thread_perms_test(ko))) { + if (unlikely(thread_perms_test(ko) == 0)) { return -EPERM; } /* Initialization state checks. _OBJ_INIT_ANY, we don't care */ if (likely(init == _OBJ_INIT_TRUE)) { /* Object MUST be intialized */ - if (unlikely(!(ko->flags & K_OBJ_FLAG_INITIALIZED))) { + if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) == 0)) { return -EINVAL; } } else if (init < _OBJ_INIT_TRUE) { /* _OBJ_INIT_FALSE case */ /* Object MUST NOT be initialized */ - if (unlikely(ko->flags & K_OBJ_FLAG_INITIALIZED)) { + if (unlikely((ko->flags & K_OBJ_FLAG_INITIALIZED) != 0)) { return -EADDRINUSE; } } else { diff --git a/kernel/work_q.c b/kernel/work_q.c index 9f21b8d290f..2558d6e831e 100644 --- a/kernel/work_q.c +++ b/kernel/work_q.c @@ -79,7 +79,7 @@ int k_delayed_work_submit_to_queue(struct k_work_q *work_q, int err = 0; /* Work cannot be active in multiple queues */ - if (work->work_q && work->work_q != work_q) { + if (work->work_q != NULL && work->work_q != work_q) { err = -EADDRINUSE; goto done; } @@ -98,7 +98,7 @@ int k_delayed_work_submit_to_queue(struct k_work_q *work_q, /* Submit work directly if no delay. Note that this is a * blocking operation, so release the lock first. */ - if (!delay) { + if (delay == 0) { k_spin_unlock(&lock, key); k_work_submit_to_queue(work_q, &work->work); return 0;