hv: refine a few functions to only one exit point

IEC 61508,ISO 26262 standards highly recommend single-exit rule.
7C: Procedure has more than one exit point.

Tracked-On: #861
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Zide Chen
2018-12-14 20:04:41 -08:00
committed by wenlingz
parent 64a463000f
commit 4c28e98dc4
3 changed files with 65 additions and 65 deletions

View File

@@ -44,10 +44,11 @@ static uint32_t get_index_of_fixed_mtrr(uint32_t msr)
for (i = 0U; i < FIXED_RANGE_MTRR_NUM; i++) {
if (fixed_mtrr_map[i].msr == msr) {
return i;
break;
}
}
return FIXED_MTRR_INVALID_INDEX;
return (i < FIXED_RANGE_MTRR_NUM) ? i : FIXED_MTRR_INVALID_INDEX;
}
static uint32_t