kernel: 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>
This commit is contained in:
Patrik Flykt 2018-11-29 11:13:40 -08:00 committed by Anas Nashif
commit d0d9eb0e38
5 changed files with 13 additions and 13 deletions

View file

@ -77,7 +77,7 @@ static void sys_power_save_idle(void)
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATE) || \ #if (defined(CONFIG_SYS_POWER_LOW_POWER_STATE) || \
defined(CONFIG_SYS_POWER_DEEP_SLEEP)) defined(CONFIG_SYS_POWER_DEEP_SLEEP))
_sys_pm_idle_exit_notify = 1; _sys_pm_idle_exit_notify = 1U;
/* /*
* Call the suspend hook function of the soc interface to allow * Call the suspend hook function of the soc interface to allow
@ -93,7 +93,7 @@ static void sys_power_save_idle(void)
* the kernel's scheduling logic. * the kernel's scheduling logic.
*/ */
if (_sys_soc_suspend(ticks) == SYS_PM_NOT_HANDLED) { if (_sys_soc_suspend(ticks) == SYS_PM_NOT_HANDLED) {
_sys_pm_idle_exit_notify = 0; _sys_pm_idle_exit_notify = 0U;
k_cpu_idle(); k_cpu_idle();
} }
#else #else

View file

@ -55,7 +55,7 @@ void _int_latency_start(void)
/* when interrupts are not already locked, take time stamp */ /* when interrupts are not already locked, take time stamp */
if (!int_locked_timestamp && int_latency_bench_ready) { if (!int_locked_timestamp && int_latency_bench_ready) {
int_locked_timestamp = k_cycle_get_32(); int_locked_timestamp = k_cycle_get_32();
int_lock_unlock_nest = 0; int_lock_unlock_nest = 0U;
} }
int_lock_unlock_nest++; int_lock_unlock_nest++;
} }
@ -108,7 +108,7 @@ void _int_latency_stop(void)
/* interrupts are now enabled, get ready for next interrupt lock /* interrupts are now enabled, get ready for next interrupt lock
*/ */
int_locked_timestamp = 0; int_locked_timestamp = 0U;
} }
} }
@ -124,7 +124,7 @@ void int_latency_init(void)
u32_t timeToReadTime; u32_t timeToReadTime;
u32_t cacheWarming = NB_CACHE_WARMING_DRY_RUN; u32_t cacheWarming = NB_CACHE_WARMING_DRY_RUN;
int_latency_bench_ready = 1; int_latency_bench_ready = 1U;
/* /*
* measuring delay introduced by the interrupt latency benchmark few * measuring delay introduced by the interrupt latency benchmark few
@ -157,7 +157,7 @@ void int_latency_init(void)
/* re-initialize globals to default values */ /* re-initialize globals to default values */
int_locked_latency_min = ULONG_MAX; int_locked_latency_min = ULONG_MAX;
int_locked_latency_max = 0; int_locked_latency_max = 0U;
cacheWarming--; cacheWarming--;
} }
@ -174,7 +174,7 @@ void int_latency_init(void)
*/ */
void int_latency_show(void) void int_latency_show(void)
{ {
u32_t intHandlerLatency = 0; u32_t intHandlerLatency = 0U;
if (!int_latency_bench_ready) { if (!int_latency_bench_ready) {
printk("error: int_latency_init() has not been invoked\n"); printk("error: int_latency_init() has not been invoked\n");
@ -183,7 +183,7 @@ void int_latency_show(void)
if (int_locked_latency_min != ULONG_MAX) { if (int_locked_latency_min != ULONG_MAX) {
if (_hw_irq_to_c_handler_latency == ULONG_MAX) { if (_hw_irq_to_c_handler_latency == ULONG_MAX) {
intHandlerLatency = 0; intHandlerLatency = 0U;
printk(" Min latency from hw interrupt up to 'C' int. " printk(" Min latency from hw interrupt up to 'C' int. "
"handler: " "handler: "
"not measured\n"); "not measured\n");
@ -221,5 +221,5 @@ void int_latency_show(void)
* disabled. * disabled.
*/ */
int_locked_latency_min = ULONG_MAX; int_locked_latency_min = ULONG_MAX;
int_locked_latency_max = 0; int_locked_latency_max = 0U;
} }

View file

@ -33,7 +33,7 @@ static bool sane_partition(const struct k_mem_partition *part,
return false; return false;
} }
for (i = 0; i < num_parts; i++) { for (i = 0U; i < num_parts; i++) {
bool cur_write, cur_exec; bool cur_write, cur_exec;
u32_t cur_last; u32_t cur_last;
@ -87,7 +87,7 @@ void k_mem_domain_init(struct k_mem_domain *domain, u8_t num_parts,
if (num_parts) { if (num_parts) {
u32_t i; u32_t i;
for (i = 0; i < num_parts; i++) { for (i = 0U; i < num_parts; i++) {
__ASSERT(parts[i] != NULL, ""); __ASSERT(parts[i] != NULL, "");
__ASSERT((parts[i]->start + parts[i]->size) > __ASSERT((parts[i]->start + parts[i]->size) >
parts[i]->start, ""); parts[i]->start, "");

View file

@ -37,7 +37,7 @@ static void create_free_list(struct k_mem_slab *slab)
slab->free_list = NULL; slab->free_list = NULL;
p = slab->buffer; p = slab->buffer;
for (j = 0; j < slab->num_blocks; j++) { for (j = 0U; j < slab->num_blocks; j++) {
*(char **)p = slab->free_list; *(char **)p = slab->free_list;
slab->free_list = p; slab->free_list = p;
p += slab->block_size; p += slab->block_size;

View file

@ -210,7 +210,7 @@ void k_disable_sys_clock_always_on(void)
s64_t z_tick_get(void) s64_t z_tick_get(void)
{ {
u64_t t = 0; u64_t t = 0U;
LOCKED(&timeout_lock) { LOCKED(&timeout_lock) {
t = curr_tick + z_clock_elapsed(); t = curr_tick + z_clock_elapsed();