mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-18 01:12:21 +00:00
HV: treewide: fix warnings raised by Clang
This patch fixes the following warnings detected by the LLVM/Clang compiler: 1. Unused static functions in C sources, which are fixed by explicitly tagging them with __unused 2. Duplicated parentheses around branch conditions 3. Assigning 64-bit constants to 32-bit variables, which is fixed by promoting the variables to uint64_t 4. Using { '\0' } to zero-fill an array, which is fixed by replacing it with { 0 } 5. Taking a bit out of a variable using && (which should be & instead) Most changes do not have a semantic impact, except item 5 which is probably a real code issue. Tracked-On: #6776 Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
496a653b0d
commit
4cf6c288cd
@ -266,7 +266,7 @@ static inline uint32_t seg_desc_type(uint32_t access)
|
|||||||
return (access & 0x001fU);
|
return (access & 0x001fU);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool seg_desc_present(uint32_t access)
|
__unused static inline bool seg_desc_present(uint32_t access)
|
||||||
{
|
{
|
||||||
return ((access & 0x0080U) != 0U);
|
return ((access & 0x0080U) != 0U);
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ static inline bool seg_desc_def32(uint32_t access)
|
|||||||
return ((access & 0x4000U) != 0U);
|
return ((access & 0x4000U) != 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool seg_desc_unusable(uint32_t access)
|
__unused static inline bool seg_desc_unusable(uint32_t access)
|
||||||
{
|
{
|
||||||
return ((access & 0x10000U) != 0U);
|
return ((access & 0x10000U) != 0U);
|
||||||
}
|
}
|
||||||
@ -439,7 +439,7 @@ static uint32_t get_vmcs_field(enum cpu_reg_name ident)
|
|||||||
static uint64_t vm_get_register(const struct acrn_vcpu *vcpu, enum cpu_reg_name reg)
|
static uint64_t vm_get_register(const struct acrn_vcpu *vcpu, enum cpu_reg_name reg)
|
||||||
{
|
{
|
||||||
uint64_t reg_val = 0UL;
|
uint64_t reg_val = 0UL;
|
||||||
|
|
||||||
if ((reg >= CPU_REG_GENERAL_FIRST) && (reg <= CPU_REG_GENERAL_LAST)) {
|
if ((reg >= CPU_REG_GENERAL_FIRST) && (reg <= CPU_REG_GENERAL_LAST)) {
|
||||||
reg_val = vcpu_get_gpreg(vcpu, reg);
|
reg_val = vcpu_get_gpreg(vcpu, reg);
|
||||||
} else if ((reg >= CPU_REG_NONGENERAL_FIRST) &&
|
} else if ((reg >= CPU_REG_NONGENERAL_FIRST) &&
|
||||||
@ -2470,4 +2470,3 @@ bool is_current_opcode_xchg(struct acrn_vcpu *vcpu)
|
|||||||
{
|
{
|
||||||
return (vcpu->inst_ctxt.vie.op.op_type == VIE_OP_TYPE_XCHG);
|
return (vcpu->inst_ctxt.vie.op.op_type == VIE_OP_TYPE_XCHG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ void create_service_vm_e820(struct acrn_vm *vm)
|
|||||||
|
|
||||||
for (i = 0U; i < vm->e820_entry_num; i++) {
|
for (i = 0U; i < vm->e820_entry_num; i++) {
|
||||||
struct e820_entry *entry = &service_vm_e820[i];
|
struct e820_entry *entry = &service_vm_e820[i];
|
||||||
if ((entry->type == E820_TYPE_RAM)) {
|
if (entry->type == E820_TYPE_RAM) {
|
||||||
service_vm_config->memory.size += entry->length;
|
service_vm_config->memory.size += entry->length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ vlapic_timer_divisor_shift(uint32_t dcr)
|
|||||||
return ((val + 1U) & 0x7U);
|
return ((val + 1U) & 0x7U);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool
|
__unused static inline bool
|
||||||
vlapic_lvtt_oneshot(const struct acrn_vlapic *vlapic)
|
vlapic_lvtt_oneshot(const struct acrn_vlapic *vlapic)
|
||||||
{
|
{
|
||||||
return (((vlapic->apic_page.lvt[APIC_LVT_TIMER].v) & APIC_LVTT_TM)
|
return (((vlapic->apic_page.lvt[APIC_LVT_TIMER].v) & APIC_LVTT_TM)
|
||||||
|
@ -321,9 +321,9 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_
|
|||||||
|
|
||||||
static void deny_pci_bar_access(struct acrn_vm *service_vm, const struct pci_pdev *pdev)
|
static void deny_pci_bar_access(struct acrn_vm *service_vm, const struct pci_pdev *pdev)
|
||||||
{
|
{
|
||||||
uint32_t idx, mask;
|
uint32_t idx;
|
||||||
struct pci_vbar vbar = {};
|
struct pci_vbar vbar = {};
|
||||||
uint64_t base = 0UL, size = 0UL;
|
uint64_t base = 0UL, size = 0UL, mask;
|
||||||
uint64_t *pml4_page;
|
uint64_t *pml4_page;
|
||||||
|
|
||||||
pml4_page = (uint64_t *)service_vm->arch_vm.nworld_eptp;
|
pml4_page = (uint64_t *)service_vm->arch_vm.nworld_eptp;
|
||||||
|
@ -396,7 +396,7 @@ static int32_t xsetbv_vmexit_handler(struct acrn_vcpu *vcpu)
|
|||||||
uint32_t cpl;
|
uint32_t cpl;
|
||||||
uint64_t val64;
|
uint64_t val64;
|
||||||
|
|
||||||
if (vcpu->arch.xsave_enabled && ((vcpu_get_cr4(vcpu) && CR4_OSXSAVE) != 0UL)) {
|
if (vcpu->arch.xsave_enabled && ((vcpu_get_cr4(vcpu) & CR4_OSXSAVE) != 0UL)) {
|
||||||
idx = vcpu->arch.cur_context;
|
idx = vcpu->arch.cur_context;
|
||||||
/* get current privilege level */
|
/* get current privilege level */
|
||||||
cpl = exec_vmread32(VMX_GUEST_CS_ATTR);
|
cpl = exec_vmread32(VMX_GUEST_CS_ATTR);
|
||||||
|
@ -72,7 +72,7 @@ static int32_t init_vm_kernel_info(struct acrn_vm *vm, const struct abi_module *
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cmdline parsed from abi module string, for pre-launched VMs and Service VM only. */
|
/* cmdline parsed from abi module string, for pre-launched VMs and Service VM only. */
|
||||||
static char mod_cmdline[PRE_VM_NUM + SERVICE_VM_NUM][MAX_BOOTARGS_SIZE] = { '\0' };
|
static char mod_cmdline[PRE_VM_NUM + SERVICE_VM_NUM][MAX_BOOTARGS_SIZE] = { 0 };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pre vm != NULL && abi != NULL
|
* @pre vm != NULL && abi != NULL
|
||||||
|
Loading…
Reference in New Issue
Block a user