Skip to content

Commit 2e01b4c

Browse files
chaohong-guowenlingz
authored andcommitted
HV: trival changes to meet MISRA
add @pre for routines and bracks for condition checking in vlapic.c Tracked-On: #861 Signed-off-by: Chaohong guo <chaohong.guo@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 971eb84 commit 2e01b4c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ static uint16_t vm_apicid2vcpu_id(struct acrn_vm *vm, uint8_t lapicid)
124124
return get_pcpu_nums();
125125
}
126126

127+
/*
128+
* @pre vlapic != NULL
129+
*/
127130
static uint64_t
128131
vm_active_cpus(const struct acrn_vm *vm)
129132
{
@@ -138,6 +141,9 @@ vm_active_cpus(const struct acrn_vm *vm)
138141
return dmask;
139142
}
140143

144+
/*
145+
* @pre vlapic != NULL
146+
*/
141147
uint32_t
142148
vlapic_get_apicid(const struct acrn_vlapic *vlapic)
143149
{
@@ -350,7 +356,7 @@ static uint32_t vlapic_get_ccr(const struct acrn_vlapic *vlapic)
350356

351357
vtimer = &vlapic->vtimer;
352358

353-
if ((vtimer->tmicr != 0U) && !vlapic_lvtt_tsc_deadline(vlapic)) {
359+
if ((vtimer->tmicr != 0U) && (!vlapic_lvtt_tsc_deadline(vlapic))) {
354360
uint64_t fire_tsc = vtimer->timer.fire_tsc;
355361

356362
if (now < fire_tsc) {
@@ -2049,6 +2055,9 @@ static void vlapic_timer_expired(void *data)
20492055
}
20502056
}
20512057

2058+
/*
2059+
* @pre vm != NULL
2060+
*/
20522061
static inline bool is_x2apic_enabled(const struct acrn_vlapic *vlapic)
20532062
{
20542063
bool ret;

0 commit comments

Comments
 (0)