HV: code cleanup as MISRA-C report for guest/vmsr

like: constant of unsigned int need add U/UL as surfix.
enum value can't use to give or compare with int directlly.
unsigned and signed mis-matched

Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Minggui Cao
2018-07-10 19:07:46 +08:00
committed by Jack Ren
parent 8c43ad54bf
commit 4cab8b9cc5
5 changed files with 78 additions and 78 deletions

View File

@@ -17,21 +17,18 @@
#ifndef ASSEMBLER
#define foreach_vcpu(idx, vm, vcpu) \
for (idx = 0, vcpu = vm->hw.vcpu_array[idx]; \
for (idx = 0U, vcpu = vm->hw.vcpu_array[idx]; \
(idx < vm->hw.num_vcpus) && (vcpu != NULL); \
idx++, vcpu = vm->hw.vcpu_array[idx])
/* the index is matched with emulated msrs array*/
enum {
IDX_TSC_DEADLINE,
IDX_BIOS_UPDT_TRIG,
IDX_BIOS_SIGN_ID,
IDX_TSC,
IDX_PAT,
IDX_MAX_MSR
};
#define IDX_TSC_DEADLINE 0U
#define IDX_BIOS_UPDT_TRIG (IDX_TSC_DEADLINE + 1U)
#define IDX_BIOS_SIGN_ID (IDX_BIOS_UPDT_TRIG + 1U)
#define IDX_TSC (IDX_BIOS_SIGN_ID + 1U)
#define IDX_PAT (IDX_TSC + 1U)
#define IDX_MAX_MSR (IDX_PAT + 1U)
struct vhm_request;
@@ -128,7 +125,7 @@ int copy_from_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
uint32_t size, uint32_t *err_code);
uint32_t create_guest_init_gdt(struct vm *vm, uint32_t *limit);
uint64_t create_guest_init_gdt(struct vm *vm, uint32_t *limit);
#ifdef HV_DEBUG
void get_req_info(char *str, int str_max);

View File

@@ -271,11 +271,11 @@ struct vcpu {
#endif
};
#define is_vcpu_bsp(vcpu) ((vcpu)->vcpu_id == 0)
#define is_vcpu_bsp(vcpu) ((vcpu)->vcpu_id == 0U)
/* do not update Guest RIP for next VM Enter */
static inline void vcpu_retain_rip(struct vcpu *vcpu)
{
(vcpu)->arch_vcpu.inst_len = 0;
(vcpu)->arch_vcpu.inst_len = 0U;
}
/* External Interfaces */