arch: x86: Fix 10.4 violations

Both operands of an operator in which the usual arithmetic
conversions are performed shall have the same essential
type category.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-04-02 22:44:10 -07:00 committed by Anas Nashif
commit 03544f0b77
9 changed files with 12 additions and 12 deletions

View file

@ -12,13 +12,13 @@ bool is_dmar_searched;
static bool check_sum(struct acpi_sdt *t)
{
uint8_t sum = 0, *p = (uint8_t *)t;
uint8_t sum = 0U, *p = (uint8_t *)t;
for (int i = 0; i < t->length; i++) {
sum += p[i];
}
return sum == 0;
return sum == 0U;
}

View file

@ -70,7 +70,7 @@ bool z_x86_check_stack_bounds(uintptr_t addr, size_t size, uint16_t cs)
z_interrupt_stacks[cpu_id]);
end = start + CONFIG_ISR_STACK_SIZE;
#ifdef CONFIG_USERSPACE
} else if ((cs & 0x3U) == 0 &&
} else if ((cs & 0x3U) == 0U &&
(_current->base.user_options & K_USER) != 0) {
/* The low two bits of the CS register is the privilege
* level. It will be 0 in supervisor mode and 3 in user mode

View file

@ -166,7 +166,7 @@ FUNC_NORETURN void z_x86_cpu_init(struct x86_cpuboot *cpuboot)
/* The internal cpu_number is the index to x86_cpuboot[] */
unsigned char cpu_num = (unsigned char)(cpuboot - x86_cpuboot);
if (cpu_num == 0) {
if (cpu_num == 0U) {
/* Only need to do these once per boot */
z_bss_zero();
#ifdef CONFIG_XIP

View file

@ -43,7 +43,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
switch_entry = z_thread_entry;
#endif
iframe = Z_STACK_PTR_TO_FRAME(struct x86_initial_frame, stack_ptr);
iframe->rip = 0;
iframe->rip = 0U;
thread->callee_saved.rsp = (long) iframe;
thread->callee_saved.rip = (long) switch_entry;
thread->callee_saved.rflags = EFLAGS_INITIAL;

View file

@ -162,8 +162,8 @@ static int multiboot_framebuf_init(const struct device *dev)
adj_x = info->fb_width - CONFIG_MULTIBOOT_FRAMEBUF_X;
adj_y = info->fb_height - CONFIG_MULTIBOOT_FRAMEBUF_Y;
data->pitch = (info->fb_pitch / 4) + adj_x;
adj_x /= 2;
adj_y /= 2;
adj_x /= 2U;
adj_y /= 2U;
buffer = (uint32_t *) (uintptr_t) info->fb_addr_lo;
buffer += adj_x;
buffer += adj_y * data->pitch;

View file

@ -144,7 +144,7 @@ static inline void pcie_conf(pcie_bdf_t bdf, unsigned int reg,
uint32_t pcie_conf_read(pcie_bdf_t bdf, unsigned int reg)
{
uint32_t data = 0;
uint32_t data = 0U;
pcie_conf(bdf, reg, false, &data);
return data;

View file

@ -1855,7 +1855,7 @@ uintptr_t arch_page_info_get(void *addr, uintptr_t *phys, bool clear_accessed)
* page table and makes no changes
*/
mask = 0;
options = 0;
options = 0U;
}
page_map_set(z_x86_kernel_ptables, addr, 0, &all_pte, mask, options);

View file

@ -83,5 +83,5 @@ uint64_t arch_timing_cycles_to_ns_avg(uint64_t cycles, uint32_t count)
uint32_t arch_timing_freq_get_mhz(void)
{
return (uint32_t)(arch_timing_freq_get() / 1000000);
return (uint32_t)(arch_timing_freq_get() / 1000000U);
}

View file

@ -36,7 +36,7 @@ static void efi_putchar(int c)
efibuf[n++] = c;
if (c == '\n' || n == PUTCHAR_BUFSZ) {
efibuf[n] = 0;
efibuf[n] = 0U;
efi->ConOut->OutputString(efi->ConOut, efibuf);
n = 0;
}
@ -77,7 +77,7 @@ uintptr_t __abi efi_entry(void *img_handle, struct efi_system_table *sys_tab)
printf("Zeroing %d bytes of memory at %p\n", bytes, dst);
for (int j = 0; j < bytes; j++) {
dst[j] = 0;
dst[j] = 0U;
}
}