all: Add 'U' suffix when using unsigned variables

Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
diff --git a/lib/cmsis_rtos_v1/cmsis_mailq.c b/lib/cmsis_rtos_v1/cmsis_mailq.c
index e0e54e7..cc62bb2 100644
--- a/lib/cmsis_rtos_v1/cmsis_mailq.c
+++ b/lib/cmsis_rtos_v1/cmsis_mailq.c
@@ -37,7 +37,7 @@
 		return NULL;
 	}
 
-	if (millisec == 0) {
+	if (millisec == 0U) {
 		retval = k_mem_slab_alloc(
 				(struct k_mem_slab *)(queue_def->pool),
 				(void **)&ptr, K_NO_WAIT);
@@ -71,7 +71,7 @@
 		return NULL;
 	}
 
-	if (millisec == 0) {
+	if (millisec == 0U) {
 		retval = k_mem_slab_alloc(
 				(struct k_mem_slab *)(queue_def->pool),
 				(void **)&ptr, K_NO_WAIT);
@@ -137,7 +137,7 @@
 	mmsg.rx_source_thread = K_ANY;
 	mmsg.tx_target_thread = K_ANY;
 
-	if (millisec == 0) {
+	if (millisec == 0U) {
 		retval = k_mbox_get(queue_def->mbox, &mmsg, NULL, K_NO_WAIT);
 	} else if (millisec == osWaitForever) {
 		retval = k_mbox_get(queue_def->mbox, &mmsg, NULL, K_FOREVER);
diff --git a/lib/cmsis_rtos_v1/cmsis_msgq.c b/lib/cmsis_rtos_v1/cmsis_msgq.c
index 45b5d07..5e3869c 100644
--- a/lib/cmsis_rtos_v1/cmsis_msgq.c
+++ b/lib/cmsis_rtos_v1/cmsis_msgq.c
@@ -38,7 +38,7 @@
 		return osErrorParameter;
 	}
 
-	if (millisec == 0) {
+	if (millisec == 0U) {
 		retval = k_msgq_put(queue_def->msgq, (void *)&info, K_NO_WAIT);
 	} else if (millisec == osWaitForever) {
 		retval = k_msgq_put(queue_def->msgq, (void *)&info, K_FOREVER);
@@ -70,7 +70,7 @@
 		return evt;
 	}
 
-	if (millisec == 0) {
+	if (millisec == 0U) {
 		retval = k_msgq_get(queue_def->msgq, &info, K_NO_WAIT);
 	} else if (millisec == osWaitForever) {
 		retval = k_msgq_get(queue_def->msgq, &info, K_FOREVER);
diff --git a/lib/cmsis_rtos_v1/cmsis_mutex.c b/lib/cmsis_rtos_v1/cmsis_mutex.c
index a7b1855..044258c 100644
--- a/lib/cmsis_rtos_v1/cmsis_mutex.c
+++ b/lib/cmsis_rtos_v1/cmsis_mutex.c
@@ -54,7 +54,7 @@
 
 	if (timeout == osWaitForever) {
 		status = k_mutex_lock(mutex, K_FOREVER);
-	} else if (timeout == 0) {
+	} else if (timeout == 0U) {
 		status = k_mutex_lock(mutex, K_NO_WAIT);
 	} else {
 		status = k_mutex_lock(mutex, timeout);
diff --git a/lib/cmsis_rtos_v1/cmsis_semaphore.c b/lib/cmsis_rtos_v1/cmsis_semaphore.c
index f4e53a9..6896fd7 100644
--- a/lib/cmsis_rtos_v1/cmsis_semaphore.c
+++ b/lib/cmsis_rtos_v1/cmsis_semaphore.c
@@ -56,7 +56,7 @@
 
 	if (timeout == osWaitForever) {
 		status = k_sem_take(semaphore, K_FOREVER);
-	} else if (timeout == 0) {
+	} else if (timeout == 0U) {
 		status = k_sem_take(semaphore, K_NO_WAIT);
 	} else {
 		status = k_sem_take(semaphore, timeout);
diff --git a/lib/cmsis_rtos_v1/cmsis_signal.c b/lib/cmsis_rtos_v1/cmsis_signal.c
index c0e6616..a0cfa37 100644
--- a/lib/cmsis_rtos_v1/cmsis_signal.c
+++ b/lib/cmsis_rtos_v1/cmsis_signal.c
@@ -110,7 +110,7 @@
 			evt.status = osEventSignal;
 			break;
 		case -EAGAIN:
-			if (millisec == 0) {
+			if (millisec == 0U) {
 				evt.status = osOK;
 			} else {
 				evt.status = osEventTimeout;
diff --git a/lib/cmsis_rtos_v1/cmsis_thread.c b/lib/cmsis_rtos_v1/cmsis_thread.c
index 9bf1d6a..2b50ea8 100644
--- a/lib/cmsis_rtos_v1/cmsis_thread.c
+++ b/lib/cmsis_rtos_v1/cmsis_thread.c
@@ -68,7 +68,7 @@
 		 "invalid priority\n");
 
 	stacksz = thread_def->stacksize;
-	if (stacksz == 0) {
+	if (stacksz == 0U) {
 		stacksz = CONFIG_CMSIS_THREAD_MAX_STACK_SIZE;
 	}
 
diff --git a/lib/cmsis_rtos_v2/event_flags.c b/lib/cmsis_rtos_v2/event_flags.c
index dbcddc3..61311fc 100644
--- a/lib/cmsis_rtos_v2/event_flags.c
+++ b/lib/cmsis_rtos_v2/event_flags.c
@@ -45,7 +45,7 @@
 	k_poll_signal_init(&events->poll_signal);
 	k_poll_event_init(&events->poll_event, K_POLL_TYPE_SIGNAL,
 			  K_POLL_MODE_NOTIFY_ONLY, &events->poll_signal);
-	events->signal_results = 0;
+	events->signal_results = 0U;
 
 	if (attr->name == NULL) {
 		strncpy(events->name, init_event_flags_attrs.name,
@@ -147,11 +147,11 @@
 
 		__ASSERT(events->poll_event.state == K_POLL_STATE_SIGNALED,
 			 "event state not signalled!");
-		__ASSERT(events->poll_event.signal->signaled == 1,
+		__ASSERT(events->poll_event.signal->signaled == 1U,
 			 "event signaled is not 1");
 
 		/* Reset the states to facilitate the next trigger */
-		events->poll_event.signal->signaled = 0;
+		events->poll_event.signal->signaled = 0U;
 		events->poll_event.state = K_POLL_STATE_NOT_READY;
 
 		if (options & osFlagsWaitAll) {
@@ -178,7 +178,7 @@
 			if (timeout_ms > time_delta_ms) {
 				timeout_ms -= time_delta_ms;
 			} else {
-				timeout_ms = 0;
+				timeout_ms = 0U;
 			}
 		} else {
 			break;
diff --git a/lib/cmsis_rtos_v2/mempool.c b/lib/cmsis_rtos_v2/mempool.c
index b4e3806..e12199c 100644
--- a/lib/cmsis_rtos_v2/mempool.c
+++ b/lib/cmsis_rtos_v2/mempool.c
@@ -97,7 +97,7 @@
 		return NULL;
 	}
 
-	if (timeout == 0) {
+	if (timeout == 0U) {
 		retval = k_mem_slab_alloc(
 			(struct k_mem_slab *)(&mslab->z_mslab),
 			(void **)&ptr, K_NO_WAIT);
diff --git a/lib/cmsis_rtos_v2/msgq.c b/lib/cmsis_rtos_v2/msgq.c
index 3f2419f..1374e16 100644
--- a/lib/cmsis_rtos_v2/msgq.c
+++ b/lib/cmsis_rtos_v2/msgq.c
@@ -97,7 +97,7 @@
 		return osErrorParameter;
 	}
 
-	if (timeout == 0) {
+	if (timeout == 0U) {
 		retval = k_msgq_put(&msgq->z_msgq, (void *)msg_ptr, K_NO_WAIT);
 	} else if (timeout == osWaitForever) {
 		retval = k_msgq_put(&msgq->z_msgq, (void *)msg_ptr, K_FOREVER);
@@ -135,7 +135,7 @@
 		return osErrorParameter;
 	}
 
-	if (timeout == 0) {
+	if (timeout == 0U) {
 		retval = k_msgq_get(&msgq->z_msgq, msg_ptr, K_NO_WAIT);
 	} else if (timeout == osWaitForever) {
 		retval = k_msgq_get(&msgq->z_msgq, msg_ptr, K_FOREVER);
diff --git a/lib/cmsis_rtos_v2/mutex.c b/lib/cmsis_rtos_v2/mutex.c
index 81bbaaa..4aa44c5 100644
--- a/lib/cmsis_rtos_v2/mutex.c
+++ b/lib/cmsis_rtos_v2/mutex.c
@@ -73,23 +73,23 @@
 		return osErrorISR;
 	}
 
-	if (mutex->z_mutex.lock_count == 0 ||
+	if (mutex->z_mutex.lock_count == 0U ||
 	    mutex->z_mutex.owner == _current) {
 	}
 
 	/* Throw an error if the mutex is not configured to be recursive and
 	 * the current thread is trying to acquire the mutex again.
 	 */
-	if ((mutex->state & osMutexRecursive) == 0) {
+	if ((mutex->state & osMutexRecursive) == 0U) {
 		if ((mutex->z_mutex.owner == _current) &&
-		    (mutex->z_mutex.lock_count != 0)) {
+		    (mutex->z_mutex.lock_count != 0U)) {
 			return osErrorResource;
 		}
 	}
 
 	if (timeout == osWaitForever) {
 		status = k_mutex_lock(&mutex->z_mutex, K_FOREVER);
-	} else if (timeout == 0) {
+	} else if (timeout == 0U) {
 		status = k_mutex_lock(&mutex->z_mutex, K_NO_WAIT);
 	} else {
 		status = k_mutex_lock(&mutex->z_mutex,
@@ -121,7 +121,7 @@
 	}
 
 	/* Mutex was not obtained before or was not owned by current thread */
-	if ((mutex->z_mutex.lock_count == 0) ||
+	if ((mutex->z_mutex.lock_count == 0U) ||
 	    (mutex->z_mutex.owner != _current)) {
 		return osErrorResource;
 	}
@@ -165,7 +165,7 @@
 	}
 
 	/* Mutex was not obtained before */
-	if (mutex->z_mutex.lock_count == 0) {
+	if (mutex->z_mutex.lock_count == 0U) {
 		return NULL;
 	}
 
diff --git a/lib/cmsis_rtos_v2/semaphore.c b/lib/cmsis_rtos_v2/semaphore.c
index b91230c..3de1c3e 100644
--- a/lib/cmsis_rtos_v2/semaphore.c
+++ b/lib/cmsis_rtos_v2/semaphore.c
@@ -72,7 +72,7 @@
 
 	if (timeout == osWaitForever) {
 		status = k_sem_take(&semaphore->z_semaphore, K_FOREVER);
-	} else if (timeout == 0) {
+	} else if (timeout == 0U) {
 		status = k_sem_take(&semaphore->z_semaphore, K_NO_WAIT);
 	} else {
 		status = k_sem_take(&semaphore->z_semaphore,
diff --git a/lib/cmsis_rtos_v2/thread.c b/lib/cmsis_rtos_v2/thread.c
index e7d5044..19cce68 100644
--- a/lib/cmsis_rtos_v2/thread.c
+++ b/lib/cmsis_rtos_v2/thread.c
@@ -178,12 +178,12 @@
 	k_poll_signal_init(&tid->poll_signal);
 	k_poll_event_init(&tid->poll_event, K_POLL_TYPE_SIGNAL,
 			  K_POLL_MODE_NOTIFY_ONLY, &tid->poll_signal);
-	tid->signal_results = 0;
+	tid->signal_results = 0U;
 
 	/* TODO: Do this somewhere only once */
-	if (one_time == 0) {
+	if (one_time == 0U) {
 		sys_dlist_init(&thread_list);
-		one_time = 1;
+		one_time = 1U;
 	}
 
 	sys_dlist_append(&thread_list, &tid->node);
@@ -363,7 +363,7 @@
 {
 	struct cv2_thread *tid = (struct cv2_thread *)thread_id;
 	u32_t size = tid->z_thread.stack_info.size;
-	u32_t unused = 0;
+	u32_t unused = 0U;
 
 	__ASSERT(tid, "");
 	__ASSERT(is_cmsis_rtos_v2_thread(tid), "");
@@ -543,7 +543,7 @@
 uint32_t osThreadGetCount(void)
 {
 	struct k_thread *thread;
-	u32_t count = 0;
+	u32_t count = 0U;
 
 	__ASSERT(!k_is_in_isr(), "");
 	for (thread = _kernel.threads; thread; thread = thread->next_thread) {
@@ -561,7 +561,7 @@
 uint32_t osThreadEnumerate(osThreadId_t *thread_array, uint32_t array_items)
 {
 	struct k_thread *thread;
-	u32_t count = 0;
+	u32_t count = 0U;
 	osThreadId_t tid;
 
 	__ASSERT(!k_is_in_isr(), "");
diff --git a/lib/cmsis_rtos_v2/thread_flags.c b/lib/cmsis_rtos_v2/thread_flags.c
index a33d136..d7f7693 100644
--- a/lib/cmsis_rtos_v2/thread_flags.c
+++ b/lib/cmsis_rtos_v2/thread_flags.c
@@ -132,11 +132,11 @@
 
 		__ASSERT(tid->poll_event.state == K_POLL_STATE_SIGNALED,
 			 "event state not signalled!");
-		__ASSERT(tid->poll_event.signal->signaled == 1,
+		__ASSERT(tid->poll_event.signal->signaled == 1U,
 			 "event signaled is not 1");
 
 		/* Reset the states to facilitate the next trigger */
-		tid->poll_event.signal->signaled = 0;
+		tid->poll_event.signal->signaled = 0U;
 		tid->poll_event.state = K_POLL_STATE_NOT_READY;
 
 		if (options & osFlagsWaitAll) {
@@ -162,7 +162,7 @@
 			if (timeout_ms > time_delta_ms) {
 				timeout_ms -= time_delta_ms;
 			} else {
-				timeout_ms = 0;
+				timeout_ms = 0U;
 			}
 		} else {
 			break;
diff --git a/lib/gui/lvgl/lvgl_color_1.c b/lib/gui/lvgl/lvgl_color_1.c
index 6b94db7..22cbdfd 100644
--- a/lib/gui/lvgl/lvgl_color_1.c
+++ b/lib/gui/lvgl/lvgl_color_1.c
@@ -20,7 +20,7 @@
 
 	display_get_capabilities(lvgl_display_dev, &cap);
 
-	desc.buf_size = (w * h)/8;
+	desc.buf_size = (w * h)/8U;
 	desc.width = w;
 	desc.pitch = w;
 	desc.height = h;
diff --git a/lib/gui/lvgl/lvgl_fs.c b/lib/gui/lvgl/lvgl_fs.c
index a4edb97..0d96c5b 100644
--- a/lib/gui/lvgl/lvgl_fs.c
+++ b/lib/gui/lvgl/lvgl_fs.c
@@ -91,7 +91,7 @@
 		}
 		err = 0;
 	} else if (br != NULL) {
-		*br = 0;
+		*br = 0U;
 	}
 	return errno_to_lv_fs_res(err);
 }
@@ -109,7 +109,7 @@
 		err = 0;
 	} else if (err < 0) {
 		if (bw != NULL) {
-			*bw = 0;
+			*bw = 0U;
 		}
 	} else {
 		if (bw != NULL) {
@@ -159,7 +159,7 @@
 
 	err = fs_seek((struct fs_file_t *) file, 0, FS_SEEK_END);
 	if (err != 0) {
-		*fsize = 0;
+		*fsize = 0U;
 		return errno_to_lv_fs_res(err);
 	}
 
diff --git a/lib/libc/minimal/source/stdout/prf.c b/lib/libc/minimal/source/stdout/prf.c
index 157634b..95ae07d 100644
--- a/lib/libc/minimal/source/stdout/prf.c
+++ b/lib/libc/minimal/source/stdout/prf.c
@@ -160,12 +160,12 @@
 	/* Usage in this file wants rounded behavior, not truncation.  So add
 	 * two to get the threshold right.
 	 */
-	rem += 2;
+	rem += 2U;
 
 	for (i = 0U; i < 3; i++) {
 		hi = rem >> shifts[i];
-		q = (uint64_t)(hi / 5) << shifts[i];
-		rem -= q * 5;
+		q = (uint64_t)(hi / 5U) << shifts[i];
+		rem -= q * 5U;
 		quot += q;
 	}
 
@@ -178,7 +178,7 @@
 
 	if (*digit_count > 0) {
 		*digit_count -= 1;
-		*fr = *fr * 10;
+		*fr = *fr * 10U;
 		rval = ((*fr >> 60) & 0xF) + '0';
 		*fr &= 0x0FFFFFFFFFFFFFFFull;
 	} else {
@@ -287,7 +287,7 @@
 			_rlrshift(&fract);
 			exp++;
 		}
-		fract *= 5;
+		fract *= 5U;
 		exp++;
 		decexp--;
 
diff --git a/lib/libc/minimal/source/string/string.c b/lib/libc/minimal/source/string/string.c
index 8685d4a..a974227 100644
--- a/lib/libc/minimal/source/string/string.c
+++ b/lib/libc/minimal/source/string/string.c
@@ -240,7 +240,7 @@
 	unsigned char *d_byte = (unsigned char *)d;
 	const unsigned char *s_byte = (const unsigned char *)s;
 
-	if ((((unsigned int)d ^ (unsigned int)s_byte) & 0x3) == 0) {
+	if ((((unsigned int)d ^ (unsigned int)s_byte) & 0x3) == 0U) {
 
 		/* do byte-sized copying until word-aligned or finished */
 
diff --git a/lib/os/base64.c b/lib/os/base64.c
index b4a6116..fda63dc 100644
--- a/lib/os/base64.c
+++ b/lib/os/base64.c
@@ -151,7 +151,7 @@
 		}
 
 		/* Space inside a line is an error */
-		if (x != 0) {
+		if (x != 0U) {
 			return -EINVAL;
 		}
 
@@ -159,11 +159,11 @@
 			return -EINVAL;
 		}
 
-		if (src[i] > 127 || base64_dec_map[src[i]] == 127) {
+		if (src[i] > 127 || base64_dec_map[src[i]] == 127U) {
 			return -EINVAL;
 		}
 
-		if (base64_dec_map[src[i]] < 64 && j != 0) {
+		if (base64_dec_map[src[i]] < 64 && j != 0U) {
 			return -EINVAL;
 		}
 
@@ -193,7 +193,7 @@
 			continue;
 		}
 
-		j -= (base64_dec_map[*src] == 64);
+		j -= (base64_dec_map[*src] == 64U);
 		x  = (x << 6) | (base64_dec_map[*src] & 0x3F);
 
 		if (++n == 4) {
diff --git a/lib/posix/mqueue.c b/lib/posix/mqueue.c
index da67991..1550771 100644
--- a/lib/posix/mqueue.c
+++ b/lib/posix/mqueue.c
@@ -375,7 +375,7 @@
 		return ret;
 	}
 
-	if ((mqd->flags & O_NONBLOCK) != 0) {
+	if ((mqd->flags & O_NONBLOCK) != 0U) {
 		timeout = K_NO_WAIT;
 	}
 
@@ -407,7 +407,7 @@
 		return ret;
 	}
 
-	if ((mqd->flags & O_NONBLOCK) != 0) {
+	if ((mqd->flags & O_NONBLOCK) != 0U) {
 		timeout = K_NO_WAIT;
 	}
 
diff --git a/lib/posix/pthread.c b/lib/posix/pthread.c
index 7a5f4ce..f1412d3 100644
--- a/lib/posix/pthread.c
+++ b/lib/posix/pthread.c
@@ -86,7 +86,7 @@
 {
 	int priority = schedparam->sched_priority;
 
-	if ((attr == NULL) || (attr->initialized == 0) ||
+	if ((attr == NULL) || (attr->initialized == 0U) ||
 	    (is_posix_prio_valid(priority, attr->schedpolicy) == false)) {
 		return EINVAL;
 	}
@@ -140,7 +140,7 @@
 	 * pointer and stack size. So even though POSIX 1003.1 spec accepts
 	 * attrib as NULL but zephyr needs it initialized with valid stack.
 	 */
-	if ((attr == NULL) || (attr->initialized == 0)
+	if ((attr == NULL) || (attr->initialized == 0U)
 	    || (attr->stack == NULL) || (attr->stacksize == 0)) {
 		return EINVAL;
 	}
@@ -461,7 +461,7 @@
  */
 int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
 {
-	if ((attr == NULL) || (attr->initialized == 0)) {
+	if ((attr == NULL) || (attr->initialized == 0U)) {
 		return EINVAL;
 	}
 
@@ -476,7 +476,7 @@
  */
 int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
 {
-	if ((attr == NULL) || (attr->initialized == 0) ||
+	if ((attr == NULL) || (attr->initialized == 0U) ||
 	    (detachstate != PTHREAD_CREATE_DETACHED &&
 	     detachstate != PTHREAD_CREATE_JOINABLE)) {
 		return EINVAL;
@@ -494,7 +494,7 @@
  */
 int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
 {
-	if ((attr == NULL) || (attr->initialized == 0)) {
+	if ((attr == NULL) || (attr->initialized == 0U)) {
 		return EINVAL;
 	}
 
@@ -510,7 +510,7 @@
  */
 int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
-	if ((attr == NULL) || (attr->initialized == 0) ||
+	if ((attr == NULL) || (attr->initialized == 0U) ||
 	    (policy != SCHED_RR && policy != SCHED_FIFO)) {
 		return EINVAL;
 	}
@@ -526,7 +526,7 @@
  */
 int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
 {
-	if ((attr == NULL) || (attr->initialized == 0)) {
+	if ((attr == NULL) || (attr->initialized == 0U)) {
 		return EINVAL;
 	}
 
@@ -543,7 +543,7 @@
 int pthread_attr_getstack(const pthread_attr_t *attr,
 				 void **stackaddr, size_t *stacksize)
 {
-	if ((attr == NULL) || (attr->initialized == 0)) {
+	if ((attr == NULL) || (attr->initialized == 0U)) {
 		return EINVAL;
 	}
 
@@ -560,7 +560,7 @@
 int pthread_attr_getschedparam(const pthread_attr_t *attr,
 			       struct sched_param *schedparam)
 {
-	if ((attr == NULL) || (attr->initialized == 0)) {
+	if ((attr == NULL) || (attr->initialized == 0U)) {
 		return EINVAL;
 	}
 
@@ -575,7 +575,7 @@
  */
 int pthread_attr_destroy(pthread_attr_t *attr)
 {
-	if ((attr != NULL) && (attr->initialized != 0)) {
+	if ((attr != NULL) && (attr->initialized != 0U)) {
 		attr->initialized = false;
 		return 0;
 	}
diff --git a/lib/posix/pthread_cond.c b/lib/posix/pthread_cond.c
index 320d517..7bde01e 100644
--- a/lib/posix/pthread_cond.c
+++ b/lib/posix/pthread_cond.c
@@ -11,11 +11,11 @@
 
 static int cond_wait(pthread_cond_t *cv, pthread_mutex_t *mut, int timeout)
 {
-	__ASSERT(mut->lock_count == 1, "");
+	__ASSERT(mut->lock_count == 1U, "");
 
 	int ret, key = irq_lock();
 
-	mut->lock_count = 0;
+	mut->lock_count = 0U;
 	mut->owner = NULL;
 	_ready_one_thread(&mut->wait_q);
 	ret = z_pend_curr_irqlock(key, &cv->wait_q, timeout);
diff --git a/lib/posix/pthread_mutex.c b/lib/posix/pthread_mutex.c
index c7597e4..414ad34 100644
--- a/lib/posix/pthread_mutex.c
+++ b/lib/posix/pthread_mutex.c
@@ -22,7 +22,7 @@
 {
 	int rc = 0, key = irq_lock();
 
-	if (m->lock_count == 0 && m->owner == NULL) {
+	if (m->lock_count == 0U && m->owner == NULL) {
 		m->lock_count++;
 		m->owner = pthread_self();
 
@@ -89,7 +89,7 @@
 	const pthread_mutexattr_t *mattr;
 
 	m->owner = NULL;
-	m->lock_count = 0;
+	m->lock_count = 0U;
 
 	mattr = (attr == NULL) ? &def_attr : attr;
 
@@ -127,14 +127,14 @@
 		return EPERM;
 	}
 
-	if (m->lock_count == 0) {
+	if (m->lock_count == 0U) {
 		irq_unlock(key);
 		return EINVAL;
 	}
 
 	m->lock_count--;
 
-	if (m->lock_count == 0) {
+	if (m->lock_count == 0U) {
 		thread = z_unpend_first_thread(&m->wait_q);
 		if (thread) {
 			m->owner = (pthread_t)thread;
diff --git a/lib/posix/pthread_rwlock.c b/lib/posix/pthread_rwlock.c
index fcf5b98..9639444 100644
--- a/lib/posix/pthread_rwlock.c
+++ b/lib/posix/pthread_rwlock.c
@@ -95,7 +95,7 @@
 
 	timeout = (s32_t) timespec_to_timeoutms(abstime);
 
-	if (read_lock_acquire(rwlock, timeout) != 0) {
+	if (read_lock_acquire(rwlock, timeout) != 0U) {
 		ret = ETIMEDOUT;
 	}
 
@@ -157,7 +157,7 @@
 
 	timeout = (s32_t) timespec_to_timeoutms(abstime);
 
-	if (write_lock_acquire(rwlock, timeout) != 0) {
+	if (write_lock_acquire(rwlock, timeout) != 0U) {
 		ret = ETIMEDOUT;
 	}
 
diff --git a/lib/posix/timer.c b/lib/posix/timer.c
index beefd76..e0a52b8 100644
--- a/lib/posix/timer.c
+++ b/lib/posix/timer.c
@@ -32,7 +32,7 @@
 
 	timer = (struct timer_obj *)ztimer;
 
-	if (timer->reload == 0) {
+	if (timer->reload == 0U) {
 		timer->status = NOT_ACTIVE;
 	}