mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-08 11:39:39 +00:00
HV: treewide: fix violations of coding guideline C-TY-12
The coding guideline rule C-TY-12 requires that 'all type conversions shall be explicit'. Especially implicit cases on the signedness of variables shall be avoided. This patch either adds explicit type casts or adjust local variable types to make sure that Booleans, signed and unsigned integers are not used mixedly. This patch has no semantic changes. 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
db20e277b6
commit
9781873e77
@ -65,9 +65,8 @@ static int32_t handle_dmar_devscope(struct dmar_dev_scope *dev_scope, void *addr
|
||||
if ((remaining >= (int32_t)sizeof(struct acpi_dmar_device_scope)) &&
|
||||
(remaining >= (int32_t)apci_devscope->length)) {
|
||||
path = (struct acpi_dmar_pci_path *)(apci_devscope + 1);
|
||||
path_len = (apci_devscope->length -
|
||||
sizeof(struct acpi_dmar_device_scope)) /
|
||||
sizeof(struct acpi_dmar_pci_path);
|
||||
path_len = (int32_t)((apci_devscope->length - sizeof(struct acpi_dmar_device_scope)) /
|
||||
sizeof(struct acpi_dmar_pci_path));
|
||||
|
||||
dmar_bdf = dmar_path_bdf(path_len, apci_devscope->bus, path);
|
||||
dev_scope->id = apci_devscope->enumeration_id;
|
||||
@ -122,8 +121,7 @@ static int32_t handle_one_drhd(struct acpi_dmar_hardware_unit *acpi_drhd, struct
|
||||
|
||||
drhd->dev_cnt = dev_count;
|
||||
|
||||
remaining = acpi_drhd->header.length -
|
||||
sizeof(struct acpi_dmar_hardware_unit);
|
||||
remaining = (int32_t)(acpi_drhd->header.length - sizeof(struct acpi_dmar_hardware_unit));
|
||||
|
||||
dev_scope = drhd->devices;
|
||||
|
||||
|
@ -189,7 +189,7 @@ bool is_ac_enabled(void)
|
||||
{
|
||||
bool ac_enabled = false;
|
||||
|
||||
if (has_core_cap(CORE_CAP_SPLIT_LOCK) && (msr_read(MSR_TEST_CTL) & MSR_TEST_CTL_AC_SPLITLOCK)) {
|
||||
if (has_core_cap(CORE_CAP_SPLIT_LOCK) && ((msr_read(MSR_TEST_CTL) & MSR_TEST_CTL_AC_SPLITLOCK) != 0UL)) {
|
||||
ac_enabled = true;
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ bool is_gp_enabled(void)
|
||||
{
|
||||
bool gp_enabled = false;
|
||||
|
||||
if (has_core_cap(CORE_CAP_UC_LOCK) && (msr_read(MSR_TEST_CTL) & MSR_TEST_CTL_GP_UCLOCK)) {
|
||||
if (has_core_cap(CORE_CAP_UC_LOCK) && ((msr_read(MSR_TEST_CTL) & MSR_TEST_CTL_GP_UCLOCK) != 0UL)) {
|
||||
gp_enabled = true;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ static struct cpu_state_info cpu_pm_state_info;
|
||||
static int32_t get_state_tbl_idx(const char *cpuname)
|
||||
{
|
||||
int32_t i;
|
||||
int32_t count = ARRAY_SIZE(cpu_state_tbl);
|
||||
int32_t count = (int32_t)ARRAY_SIZE(cpu_state_tbl);
|
||||
int32_t ret = -1;
|
||||
|
||||
if (cpuname != NULL) {
|
||||
|
@ -198,7 +198,7 @@ static int32_t local_gva2gpa_common(struct acrn_vcpu *vcpu, const struct page_wa
|
||||
static int32_t local_gva2gpa_pae(struct acrn_vcpu *vcpu, struct page_walk_info *pw_info,
|
||||
uint64_t gva, uint64_t *gpa, uint32_t *err_code)
|
||||
{
|
||||
int32_t index;
|
||||
uint32_t index;
|
||||
uint64_t *base;
|
||||
uint64_t entry;
|
||||
uint64_t addr;
|
||||
|
@ -290,7 +290,7 @@ static bool rt_vm_pm1a_io_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t wi
|
||||
if (width != 2U) {
|
||||
pr_dbg("Invalid address (0x%x) or width (0x%x)", addr, width);
|
||||
} else {
|
||||
if ((((v & VIRTUAL_PM1A_SLP_EN) != 0U) && (((v & VIRTUAL_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) {
|
||||
if (((v & VIRTUAL_PM1A_SLP_EN) != 0U) && (((v & VIRTUAL_PM1A_SLP_TYP) >> 10U) == 5U)) {
|
||||
poweroff_if_rt_vm(vcpu->vm);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static void update_trampoline_code_refs(uint64_t dest_pa)
|
||||
{
|
||||
void *ptr;
|
||||
uint64_t val;
|
||||
int32_t i;
|
||||
uint32_t i;
|
||||
|
||||
/*
|
||||
* calculate the fixup CS:IP according to fixup target address
|
||||
@ -88,7 +88,7 @@ static void update_trampoline_code_refs(uint64_t dest_pa)
|
||||
*(uint64_t *)(ptr) += dest_pa;
|
||||
|
||||
ptr = hpa2hva(dest_pa + trampoline_relo_addr(&trampoline_pdpt_addr));
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0U; i < 4U; i++) {
|
||||
*(uint64_t *)(ptr + sizeof(uint64_t) * i) += dest_pa;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <rtl.h>
|
||||
#include <logmsg.h>
|
||||
|
||||
static struct acrn_boot_info acrn_bi = { 0U };
|
||||
static struct acrn_boot_info acrn_bi = { 0 };
|
||||
|
||||
/**
|
||||
* @pre (p_start != NULL) && (p_end != NULL)
|
||||
|
@ -293,7 +293,7 @@ build_bitmap_testandclear(bitmap32_test_and_clear_lock, "l", uint32_t, BUS_LOCK)
|
||||
|
||||
static inline uint16_t bitmap_weight(uint64_t bits)
|
||||
{
|
||||
return __builtin_popcountl(bits);
|
||||
return (uint16_t)__builtin_popcountl(bits);
|
||||
}
|
||||
|
||||
#endif /* BITS_H*/
|
||||
|
@ -282,7 +282,7 @@ struct hc_api_version {
|
||||
uint32_t minor_version;
|
||||
} __aligned(8);
|
||||
|
||||
#define ACRN_PLATFORM_LAPIC_IDS_MAX 64
|
||||
#define ACRN_PLATFORM_LAPIC_IDS_MAX 64U
|
||||
/**
|
||||
* Hypervisor API, return it for HC_GET_PLATFORM_INFO hypercall
|
||||
*/
|
||||
|
@ -528,7 +528,7 @@ void do_print(const char *fmt_arg, struct print_param *param,
|
||||
else if (ch == 'c') {
|
||||
char c[2];
|
||||
|
||||
c[0] = __builtin_va_arg(args, int32_t);
|
||||
c[0] = (char)__builtin_va_arg(args, int32_t);
|
||||
c[1] = 0;
|
||||
print_string(param, c);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user