mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 20:00:13 +00:00
hv:Fix unused var value on all paths
MISRAC checks whether a variable is assigned a value not used in all branches of a program. Var value which is unused on all paths can be removed with a consequent improvement in the readability and efficiency of the code. This patch is used to fix these violations. Tracked-On: #861 Signed-off-by: Junjun Shan <junjun.shan@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -247,6 +247,9 @@ static void encode_vmcs_seg_desc(enum cpu_reg_name seg,
|
||||
desc->access_field = 0xffffffffU;
|
||||
break;
|
||||
default:
|
||||
desc->base_field = 0U;
|
||||
desc->limit_field = 0U;
|
||||
desc->access_field = 0U;
|
||||
pr_err("%s: invalid seg %d", __func__, seg);
|
||||
break;
|
||||
}
|
||||
@@ -374,7 +377,7 @@ static void vm_set_register(struct vcpu *vcpu, enum cpu_reg_name reg,
|
||||
*/
|
||||
static void vm_get_seg_desc(enum cpu_reg_name seg, struct seg_desc *desc)
|
||||
{
|
||||
struct seg_desc_vmcs tdesc = {0U, 0U, 0U};
|
||||
struct seg_desc_vmcs tdesc;
|
||||
|
||||
/* tdesc->access != 0xffffffffU in this function */
|
||||
encode_vmcs_seg_desc(seg, &tdesc);
|
||||
@@ -2188,7 +2191,7 @@ static int instr_check_di(struct vcpu *vcpu, struct instr_emul_ctxt *emul_ctxt)
|
||||
static int instr_check_gva(struct vcpu *vcpu, struct instr_emul_ctxt *emul_ctxt,
|
||||
enum vm_cpu_mode cpu_mode)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
uint64_t base, segbase, idx, gva, gpa;
|
||||
uint32_t err_code;
|
||||
enum cpu_reg_name seg;
|
||||
@@ -2274,7 +2277,7 @@ int decode_instruction(struct vcpu *vcpu)
|
||||
{
|
||||
struct instr_emul_ctxt *emul_ctxt;
|
||||
uint32_t csar;
|
||||
int retval = 0;
|
||||
int retval;
|
||||
enum vm_cpu_mode cpu_mode;
|
||||
|
||||
emul_ctxt = &per_cpu(g_inst_ctxt, vcpu->pcpu_id);
|
||||
|
@@ -10,7 +10,7 @@
|
||||
uint64_t get_microcode_version(void)
|
||||
{
|
||||
uint64_t val;
|
||||
uint32_t eax = 0U, ebx = 0U, ecx = 0U, edx = 0U;
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
|
||||
msr_write(MSR_IA32_BIOS_SIGN_ID, 0U);
|
||||
cpuid(CPUID_FEATURES, &eax, &ebx, &ecx, &edx);
|
||||
|
@@ -280,8 +280,8 @@ void free_paging_struct(void *ptr)
|
||||
|
||||
bool check_continuous_hpa(struct vm *vm, uint64_t gpa_arg, uint64_t size_arg)
|
||||
{
|
||||
uint64_t curr_hpa = 0UL;
|
||||
uint64_t next_hpa = 0UL;
|
||||
uint64_t curr_hpa;
|
||||
uint64_t next_hpa;
|
||||
uint64_t gpa = gpa_arg;
|
||||
uint64_t size = size_arg;
|
||||
|
||||
|
@@ -60,13 +60,13 @@ static struct trusty_key_info g_key_info = {
|
||||
static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
|
||||
uint64_t size, uint64_t gpa_rebased)
|
||||
{
|
||||
uint64_t nworld_pml4e = 0UL;
|
||||
uint64_t sworld_pml4e = 0UL;
|
||||
uint64_t gpa = 0UL;
|
||||
uint64_t nworld_pml4e;
|
||||
uint64_t sworld_pml4e;
|
||||
uint64_t gpa;
|
||||
uint64_t hpa = gpa2hpa(vm, gpa_orig);
|
||||
uint64_t table_present = EPT_RWX;
|
||||
uint64_t pdpte = 0UL, *dest_pdpte_p = NULL, *src_pdpte_p = NULL;
|
||||
void *sub_table_addr = NULL, *pml4_base = NULL;
|
||||
uint64_t pdpte, *dest_pdpte_p, *src_pdpte_p;
|
||||
void *sub_table_addr, *pml4_base;
|
||||
struct vm *vm0 = get_vm_from_vmid(0U);
|
||||
uint16_t i;
|
||||
|
||||
|
@@ -965,7 +965,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
|
||||
struct dmar_context_entry *context_table;
|
||||
struct dmar_root_entry *root_entry;
|
||||
struct dmar_context_entry *context_entry;
|
||||
uint64_t upper = 0UL;
|
||||
uint64_t upper;
|
||||
uint64_t lower = 0UL;
|
||||
|
||||
if (domain == NULL) {
|
||||
|
Reference in New Issue
Block a user