hv: debug: fix "Procedure has more than one exit point"

IEC 61508,ISO 26262 standards highly recommend single-exit rule.

Reduce the count of the "return entries".
Fix the violations which is comply with the cases list below:
1.Function has 2 return entries.
2.The first return entry is used to return the error code of
checking variable whether is valid.

Fix the violations in "if else" format.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi 2018-11-29 11:10:28 +08:00 committed by wenlingz
parent 414860fb89
commit fe3de67906

View File

@ -170,12 +170,7 @@ static void profiling_disable_pmu(void)
dev_dbg(ACRN_DBG_PROFILING, "%s: entering cpu%d",
__func__, get_cpu_id());
if (ss == NULL) {
dev_dbg(ACRN_ERR_PROFILING, "%s: exiting cpu%d",
__func__, get_cpu_id());
return;
}
if (ss != NULL) {
if (ss->vmexit_msr_cnt == 1) {
/* Set the VM Exit MSR Load in VMCS */
exec_vmwrite(VMX_EXIT_MSR_LOAD_COUNT, 0x0U);
@ -207,11 +202,14 @@ static void profiling_disable_pmu(void)
lvt_perf_ctr |= LVT_PERFCTR_BIT_MASK;
msr_write(MSR_IA32_EXT_APIC_LVT_PMI, lvt_perf_ctr);
ss->pmu_state = PMU_SETUP;
dev_dbg(ACRN_DBG_PROFILING, "%s: exiting cpu%d",
__func__, get_cpu_id());
} else {
dev_dbg(ACRN_ERR_PROFILING, "%s: exiting cpu%d",
__func__, get_cpu_id());
}
}
/*
@ -759,10 +757,7 @@ void profiling_stop_pmu(void)
dev_dbg(ACRN_DBG_PROFILING, "%s: entering", __func__);
if (!in_pmu_profiling) {
return;
}
if (in_pmu_profiling) {
for (i = 0U; i < phys_cpu_num; i++) {
per_cpu(profiling_info.ipi_cmd, i) = IPI_PMU_STOP;
if (per_cpu(profiling_info.sep_state, i).pmu_state == PMU_RUNNING) {
@ -803,6 +798,8 @@ void profiling_stop_pmu(void)
dev_dbg(ACRN_DBG_PROFILING, "%s: done.", __func__);
}
}
/*
* Performs MSR operations on all the CPU's