Skip to content

Commit 03544f0

Browse files
Flavio Ceolinnashif
authored andcommitted
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 <[email protected]>
1 parent fd777c3 commit 03544f0

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

arch/x86/core/acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ bool is_dmar_searched;
1212

1313
static bool check_sum(struct acpi_sdt *t)
1414
{
15-
uint8_t sum = 0, *p = (uint8_t *)t;
15+
uint8_t sum = 0U, *p = (uint8_t *)t;
1616

1717
for (int i = 0; i < t->length; i++) {
1818
sum += p[i];
1919
}
2020

21-
return sum == 0;
21+
return sum == 0U;
2222
}
2323

2424

arch/x86/core/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bool z_x86_check_stack_bounds(uintptr_t addr, size_t size, uint16_t cs)
7070
z_interrupt_stacks[cpu_id]);
7171
end = start + CONFIG_ISR_STACK_SIZE;
7272
#ifdef CONFIG_USERSPACE
73-
} else if ((cs & 0x3U) == 0 &&
73+
} else if ((cs & 0x3U) == 0U &&
7474
(_current->base.user_options & K_USER) != 0) {
7575
/* The low two bits of the CS register is the privilege
7676
* level. It will be 0 in supervisor mode and 3 in user mode

arch/x86/core/intel64/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ FUNC_NORETURN void z_x86_cpu_init(struct x86_cpuboot *cpuboot)
166166
/* The internal cpu_number is the index to x86_cpuboot[] */
167167
unsigned char cpu_num = (unsigned char)(cpuboot - x86_cpuboot);
168168

169-
if (cpu_num == 0) {
169+
if (cpu_num == 0U) {
170170
/* Only need to do these once per boot */
171171
z_bss_zero();
172172
#ifdef CONFIG_XIP

arch/x86/core/intel64/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
4343
switch_entry = z_thread_entry;
4444
#endif
4545
iframe = Z_STACK_PTR_TO_FRAME(struct x86_initial_frame, stack_ptr);
46-
iframe->rip = 0;
46+
iframe->rip = 0U;
4747
thread->callee_saved.rsp = (long) iframe;
4848
thread->callee_saved.rip = (long) switch_entry;
4949
thread->callee_saved.rflags = EFLAGS_INITIAL;

arch/x86/core/multiboot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ static int multiboot_framebuf_init(const struct device *dev)
162162
adj_x = info->fb_width - CONFIG_MULTIBOOT_FRAMEBUF_X;
163163
adj_y = info->fb_height - CONFIG_MULTIBOOT_FRAMEBUF_Y;
164164
data->pitch = (info->fb_pitch / 4) + adj_x;
165-
adj_x /= 2;
166-
adj_y /= 2;
165+
adj_x /= 2U;
166+
adj_y /= 2U;
167167
buffer = (uint32_t *) (uintptr_t) info->fb_addr_lo;
168168
buffer += adj_x;
169169
buffer += adj_y * data->pitch;

arch/x86/core/pcie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static inline void pcie_conf(pcie_bdf_t bdf, unsigned int reg,
144144

145145
uint32_t pcie_conf_read(pcie_bdf_t bdf, unsigned int reg)
146146
{
147-
uint32_t data = 0;
147+
uint32_t data = 0U;
148148

149149
pcie_conf(bdf, reg, false, &data);
150150
return data;

arch/x86/core/x86_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ uintptr_t arch_page_info_get(void *addr, uintptr_t *phys, bool clear_accessed)
18551855
* page table and makes no changes
18561856
*/
18571857
mask = 0;
1858-
options = 0;
1858+
options = 0U;
18591859
}
18601860

18611861
page_map_set(z_x86_kernel_ptables, addr, 0, &all_pte, mask, options);

arch/x86/timing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ uint64_t arch_timing_cycles_to_ns_avg(uint64_t cycles, uint32_t count)
8383

8484
uint32_t arch_timing_freq_get_mhz(void)
8585
{
86-
return (uint32_t)(arch_timing_freq_get() / 1000000);
86+
return (uint32_t)(arch_timing_freq_get() / 1000000U);
8787
}

arch/x86/zefi/zefi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void efi_putchar(int c)
3636
efibuf[n++] = c;
3737

3838
if (c == '\n' || n == PUTCHAR_BUFSZ) {
39-
efibuf[n] = 0;
39+
efibuf[n] = 0U;
4040
efi->ConOut->OutputString(efi->ConOut, efibuf);
4141
n = 0;
4242
}
@@ -77,7 +77,7 @@ uintptr_t __abi efi_entry(void *img_handle, struct efi_system_table *sys_tab)
7777

7878
printf("Zeroing %d bytes of memory at %p\n", bytes, dst);
7979
for (int j = 0; j < bytes; j++) {
80-
dst[j] = 0;
80+
dst[j] = 0U;
8181
}
8282
}
8383

0 commit comments

Comments
 (0)