lib: Add 'U' to unsigned variable assignments

Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
diff --git a/lib/base64/base64.c b/lib/base64/base64.c
index 92c30fd..b4a6116 100644
--- a/lib/base64/base64.c
+++ b/lib/base64/base64.c
@@ -113,7 +113,7 @@
 	}
 
 	*olen = p - dst;
-	*p = 0;
+	*p = 0U;
 
 	return 0;
 }
@@ -129,9 +129,9 @@
 	u8_t *p;
 
 	/* First pass: check for validity and get output length */
-	for (i = n = j = 0; i < slen; i++) {
+	for (i = n = j = 0U; i < slen; i++) {
 		/* Skip spaces before checking for EOL */
-		x = 0;
+		x = 0U;
 		while (i < slen && src[i] == ' ') {
 			++i;
 			++x;
@@ -187,7 +187,7 @@
 		return -ENOMEM;
 	}
 
-	for (j = 3, n = x = 0, p = dst; i > 0; i--, src++) {
+	for (j = 3U, n = x = 0U, p = dst; i > 0; i--, src++) {
 
 		if (*src == '\r' || *src == '\n' || *src == ' ') {
 			continue;
diff --git a/lib/cmsis_rtos_v1/cmsis_signal.c b/lib/cmsis_rtos_v1/cmsis_signal.c
index 8e39ea8..c0e6616 100644
--- a/lib/cmsis_rtos_v1/cmsis_signal.c
+++ b/lib/cmsis_rtos_v1/cmsis_signal.c
@@ -148,7 +148,7 @@
 		if (timeout > time_delta_ms) {
 			timeout -= time_delta_ms;
 		} else {
-			timeout = 0;
+			timeout = 0U;
 		}
 	}
 
diff --git a/lib/libc/minimal/source/stdout/prf.c b/lib/libc/minimal/source/stdout/prf.c
index d47b342..bf7410d 100644
--- a/lib/libc/minimal/source/stdout/prf.c
+++ b/lib/libc/minimal/source/stdout/prf.c
@@ -154,7 +154,7 @@
 static void _ldiv5(uint64_t *v)
 {
 	uint32_t i, hi;
-	uint64_t rem = *v, quot = 0, q;
+	uint64_t rem = *v, quot = 0U, q;
 	static const char shifts[] = { 32, 3, 0 };
 
 	/* Usage in this file wants rounded behavior, not truncation.  So add
@@ -162,7 +162,7 @@
 	 */
 	rem += 2;
 
-	for (i = 0; i < 3; i++) {
+	for (i = 0U; i < 3; i++) {
 		hi = rem >> shifts[i];
 		q = (uint64_t)(hi / 5) << shifts[i];
 		rem -= q * 5;
diff --git a/lib/libc/minimal/source/string/strncasecmp.c b/lib/libc/minimal/source/string/strncasecmp.c
index ba583b0..e3e3c7a 100644
--- a/lib/libc/minimal/source/string/strncasecmp.c
+++ b/lib/libc/minimal/source/string/strncasecmp.c
@@ -10,7 +10,7 @@
 int
 strncasecmp(const char *s1, const char *s2, size_t n)
 {
-	unsigned char c = 1;
+	unsigned char c = 1U;
 
 	for (; c && n != 0; n--) {
 		unsigned char lower1, lower2;
diff --git a/lib/posix/mqueue.c b/lib/posix/mqueue.c
index 3a06147..5c69a3d 100644
--- a/lib/posix/mqueue.c
+++ b/lib/posix/mqueue.c
@@ -51,7 +51,7 @@
 	va_list va;
 	mode_t mode;
 	mq_attr *attrs = NULL;
-	u32_t msg_size = 0, max_msgs = 0;
+	u32_t msg_size = 0U, max_msgs = 0U;
 	mqueue_object *msg_queue;
 	mqueue_desc *msg_queue_desc = NULL, *mqd = (mqueue_desc *)(-1);
 	char *mq_desc_ptr, *mq_obj_ptr, *mq_buf_ptr, *mq_name_ptr;
diff --git a/lib/posix/pthread_rwlock.c b/lib/posix/pthread_rwlock.c
index 145f6e8..f2c0521 100644
--- a/lib/posix/pthread_rwlock.c
+++ b/lib/posix/pthread_rwlock.c
@@ -86,7 +86,7 @@
 			       const struct timespec *abstime)
 {
 	s32_t timeout;
-	u32_t ret = 0;
+	u32_t ret = 0U;
 
 	if (rwlock->status == NOT_INITIALIZED || abstime->tv_nsec < 0 ||
 	    abstime->tv_nsec > NSEC_PER_SEC) {
@@ -148,7 +148,7 @@
 			       const struct timespec *abstime)
 {
 	s32_t timeout;
-	u32_t ret = 0;
+	u32_t ret = 0U;
 
 	if (rwlock->status == NOT_INITIALIZED || abstime->tv_nsec < 0 ||
 	    abstime->tv_nsec > NSEC_PER_SEC) {
@@ -214,7 +214,7 @@
 
 static u32_t read_lock_acquire(pthread_rwlock_t *rwlock, s32_t timeout)
 {
-	u32_t ret = 0;
+	u32_t ret = 0U;
 
 	if (k_sem_take(&rwlock->wr_sem, timeout) == 0) {
 		k_sem_take(&rwlock->reader_active, K_NO_WAIT);
@@ -229,7 +229,7 @@
 
 static u32_t write_lock_acquire(pthread_rwlock_t *rwlock, s32_t timeout)
 {
-	u32_t ret = 0;
+	u32_t ret = 0U;
 	s64_t elapsed_time, st_time = k_uptime_get();
 
 	/* waiting for release of write lock */
diff --git a/lib/posix/timer.c b/lib/posix/timer.c
index 3690043..fd4ba78 100644
--- a/lib/posix/timer.c
+++ b/lib/posix/timer.c
@@ -69,7 +69,7 @@
 	timer->val = evp->sigev_value;
 	timer->interval.tv_sec = 0;
 	timer->interval.tv_nsec = 0;
-	timer->reload = 0;
+	timer->reload = 0U;
 	timer->status = NOT_ACTIVE;
 
 	if (evp->sigev_notify == SIGEV_NONE) {
@@ -163,7 +163,7 @@
 		current = k_timer_remaining_get(&timer->ztimer);
 
 		if (current >= duration) {
-			duration = 0;
+			duration = 0U;
 		} else {
 			duration -= current;
 		}
diff --git a/lib/ring_buffer/ring_buffer.c b/lib/ring_buffer/ring_buffer.c
index d69b637..6c9b149 100644
--- a/lib/ring_buffer/ring_buffer.c
+++ b/lib/ring_buffer/ring_buffer.c
@@ -35,19 +35,19 @@
 		header->value = value;
 
 		if (likely(buf->mask)) {
-			for (i = 0; i < size32; ++i) {
+			for (i = 0U; i < size32; ++i) {
 				index = (i + buf->tail + 1) & buf->mask;
 				buf->buf.buf32[index] = data[i];
 			}
 			buf->tail = (buf->tail + size32 + 1) & buf->mask;
 		} else {
-			for (i = 0; i < size32; ++i) {
+			for (i = 0U; i < size32; ++i) {
 				index = (i + buf->tail + 1) % buf->size;
 				buf->buf.buf32[index] = data[i];
 			}
 			buf->tail = (buf->tail + size32 + 1) % buf->size;
 		}
-		rc = 0;
+		rc = 0U;
 	} else {
 		buf->misc.item_mode.dropped_put_count++;
 		rc = -EMSGSIZE;
@@ -78,13 +78,13 @@
 	*value = header->value;
 
 	if (likely(buf->mask)) {
-		for (i = 0; i < header->length; ++i) {
+		for (i = 0U; i < header->length; ++i) {
 			index = (i + buf->head + 1) & buf->mask;
 			data[i] = buf->buf.buf32[index];
 		}
 		buf->head = (buf->head + header->length + 1) & buf->mask;
 	} else {
-		for (i = 0; i < header->length; ++i) {
+		for (i = 0U; i < header->length; ++i) {
 			index = (i + buf->head + 1) % buf->size;
 			data[i] = buf->buf.buf32[index];
 		}
@@ -143,7 +143,7 @@
 {
 	u8_t *dst;
 	u32_t partial_size;
-	u32_t total_size = 0;
+	u32_t total_size = 0U;
 
 	do {
 		partial_size = ring_buf_put_claim(buf, &dst, size);
@@ -199,7 +199,7 @@
 {
 	u8_t *src;
 	u32_t partial_size;
-	u32_t total_size = 0;
+	u32_t total_size = 0U;
 
 	do {
 		partial_size = ring_buf_get_claim(buf, &src, size);