Skip to content

Commit 9063504

Browse files
Shawnshhwenlingz
authored andcommitted
HV: ve820 fix "Casting operation to a pointer"
ACRN Coding guidelines requires two different types pointer can't convert to each other, except void *. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
1 parent 1aef529 commit 9063504

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

hypervisor/arch/x86/configs/apl-mrb/ve820.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ static const struct e820_entry ve820_entry[VE820_ENTRIES_APL_MRB] = {
4646
void create_prelaunched_vm_e820(struct acrn_vm *vm)
4747
{
4848
vm->e820_entry_num = VE820_ENTRIES_APL_MRB;
49-
vm->e820_entries = (struct e820_entry *)ve820_entry;
49+
vm->e820_entries = ve820_entry;
5050
}

hypervisor/arch/x86/configs/dnv-cb2/ve820.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ static const struct e820_entry ve820_entry[VE820_ENTRIES_DNV_CB2] = {
4646
void create_prelaunched_vm_e820(struct acrn_vm *vm)
4747
{
4848
vm->e820_entry_num = VE820_ENTRIES_DNV_CB2;
49-
vm->e820_entries = (struct e820_entry *)ve820_entry;
49+
vm->e820_entries = ve820_entry;
5050
}

hypervisor/arch/x86/configs/nuc7i7bnh/ve820.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ static const struct e820_entry ve820_entry[VE820_ENTRIES_KBL_NUC_i7] = {
4545
void create_prelaunched_vm_e820(struct acrn_vm *vm)
4646
{
4747
vm->e820_entry_num = VE820_ENTRIES_KBL_NUC_i7;
48-
vm->e820_entries = (struct e820_entry *)ve820_entry;
48+
vm->e820_entries = ve820_entry;
4949
}

hypervisor/arch/x86/guest/vm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_
188188
uint32_t i;
189189

190190
for (i = 0U; i < vm->e820_entry_num; i++) {
191-
struct e820_entry *entry = &(vm->e820_entries[i]);
191+
const struct e820_entry *entry = &(vm->e820_entries[i]);
192192

193193
if (entry->length == 0UL) {
194194
break;
@@ -327,7 +327,7 @@ static void prepare_sos_vm_memmap(struct acrn_vm *vm)
327327

328328
const struct e820_entry *entry;
329329
uint32_t entries_count = vm->e820_entry_num;
330-
struct e820_entry *p_e820 = vm->e820_entries;
330+
const struct e820_entry *p_e820 = vm->e820_entries;
331331
const struct e820_mem_params *p_e820_mem_info = get_e820_mem_info();
332332

333333
pr_dbg("sos_vm: bottom memory - 0x%llx, top memory - 0x%llx\n",

hypervisor/common/vm_load.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static uint32_t create_zeropage_e820(struct zero_page *zp, const struct acrn_vm
3838
{
3939
uint32_t entry_num = vm->e820_entry_num;
4040
struct e820_entry *zp_e820 = zp->entries;
41-
struct e820_entry *vm_e820 = vm->e820_entries;
41+
const struct e820_entry *vm_e820 = vm->e820_entries;
4242

4343
if ((zp_e820 == NULL) || (vm_e820 == NULL) || (entry_num == 0U) || (entry_num > E820_MAX_ENTRIES)) {
4444
pr_err("e820 create error");

hypervisor/include/arch/x86/guest/vm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct acrn_vm {
111111
struct vm_sw_info sw; /* Reference to SW associated with this VM */
112112
struct vm_pm_info pm; /* Reference to this VM's arch information */
113113
uint32_t e820_entry_num;
114-
struct e820_entry *e820_entries;
114+
const struct e820_entry *e820_entries;
115115
uint16_t vm_id; /* Virtual machine identifier */
116116
enum vm_state state; /* VM state */
117117
struct acrn_vuart vuart[MAX_VUART_NUM_PER_VM]; /* Virtual UART */

0 commit comments

Comments
 (0)