mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-15 05:49:17 +00:00
HV:treewide:fix "expression is not Boolean"
MISRA C explicit required expression should be boolean when in branch statements (if,while...). Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -114,8 +114,8 @@ biosacpi_search_rsdp(char *base, int length)
|
||||
rsdp = (struct acpi_table_rsdp *)(base + ofs);
|
||||
|
||||
/* compare signature, validate checksum */
|
||||
if (!strncmp(rsdp->signature, ACPI_SIG_RSDP,
|
||||
strnlen_s(ACPI_SIG_RSDP, 8))) {
|
||||
if (strncmp(rsdp->signature, ACPI_SIG_RSDP,
|
||||
strnlen_s(ACPI_SIG_RSDP, 8)) == 0) {
|
||||
cp = (uint8_t *)rsdp;
|
||||
sum = 0;
|
||||
for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++)
|
||||
@@ -179,7 +179,7 @@ void *get_acpi_tbl(char *sig)
|
||||
|
||||
rsdp = (struct acpi_table_rsdp *)global_rsdp;
|
||||
|
||||
if (rsdp->revision >= 2 && rsdp->xsdt_physical_address) {
|
||||
if (rsdp->revision >= 2 && (rsdp->xsdt_physical_address != 0U)) {
|
||||
/*
|
||||
* AcpiOsGetRootPointer only verifies the checksum for
|
||||
* the version 1.0 portion of the RSDP. Version 2.0 has
|
||||
@@ -191,7 +191,7 @@ void *get_acpi_tbl(char *sig)
|
||||
sizeof(uint64_t);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (probe_table(xsdt->table_offset_entry[i], sig)) {
|
||||
if (probe_table(xsdt->table_offset_entry[i], sig) != 0) {
|
||||
addr = xsdt->table_offset_entry[i];
|
||||
break;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ void *get_acpi_tbl(char *sig)
|
||||
sizeof(uint32_t);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (probe_table(rsdt->table_offset_entry[i], sig)) {
|
||||
if (probe_table(rsdt->table_offset_entry[i], sig) != 0) {
|
||||
addr = rsdt->table_offset_entry[i];
|
||||
break;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ static int _parse_madt(void *madt, uint8_t *lapic_id_base)
|
||||
|
||||
if (entry->type == ACPI_MADT_TYPE_LOCAL_APIC) {
|
||||
processor = (struct acpi_madt_local_apic *)entry;
|
||||
if (processor->lapic_flags & ACPI_MADT_ENABLED) {
|
||||
if ((processor->lapic_flags & ACPI_MADT_ENABLED) != 0U) {
|
||||
*lapic_id_base++ = processor->id;
|
||||
pcpu_id++;
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ static void parse_other_modules(struct vm *vm,
|
||||
start++;
|
||||
|
||||
end = start;
|
||||
while (*end != ' ' && *end)
|
||||
while (*end != ' ' && (*end) != 0)
|
||||
end++;
|
||||
|
||||
type_len = end - start;
|
||||
@@ -58,7 +58,7 @@ static void parse_other_modules(struct vm *vm,
|
||||
dev_dbg(ACRN_DBG_BOOT, "fw-%d: %s", i, dyn_bootargs);
|
||||
|
||||
/*copy boot args to load addr, set src=load addr*/
|
||||
if (copy_once) {
|
||||
if (copy_once != 0) {
|
||||
copy_once = 0;
|
||||
strcpy_s(load_addr, MEM_2K,
|
||||
vm->sw.linux_info.bootargs_src_addr);
|
||||
@@ -95,7 +95,7 @@ static void *get_kernel_load_addr(void *kernel_src_addr)
|
||||
* non-relocatable.
|
||||
*/
|
||||
zeropage = (struct zero_page *)kernel_src_addr;
|
||||
if (zeropage->hdr.relocatable_kernel)
|
||||
if (zeropage->hdr.relocatable_kernel != 0U)
|
||||
return (void *)zeropage->hdr.pref_addr;
|
||||
|
||||
return kernel_src_addr;
|
||||
@@ -112,15 +112,15 @@ int init_vm0_boot_info(struct vm *vm)
|
||||
}
|
||||
|
||||
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
||||
ASSERT(0, "no multiboot info found");
|
||||
ASSERT(false, "no multiboot info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mbi = (struct multiboot_info *)((uint64_t)boot_regs[1]);
|
||||
|
||||
dev_dbg(ACRN_DBG_BOOT, "Multiboot detected, flag=0x%x", mbi->mi_flags);
|
||||
if (!(mbi->mi_flags & MULTIBOOT_INFO_HAS_MODS)) {
|
||||
ASSERT(0, "no sos kernel info found");
|
||||
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) {
|
||||
ASSERT(false, "no sos kernel info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ int init_vm0_boot_info(struct vm *vm)
|
||||
* If there is cmdline from mbi->mi_cmdline, merge it with
|
||||
* mods[0].mm_string
|
||||
*/
|
||||
if (mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) {
|
||||
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
|
||||
char *cmd_src, *cmd_dst;
|
||||
int off = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user