mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
HV: Fix missing brackets for MISRA C Violations
Patch 6 of 7. Added changes to make sure Misra C violations are fixed for rules 11S and 12S. Signed-off-by: Arindam Roy <arindam.roy@intel.com>
This commit is contained in:
@@ -64,8 +64,9 @@ int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
|
||||
"vhm_request page broken!");
|
||||
|
||||
|
||||
if (vcpu == NULL || req == NULL || vcpu->vm->sw.io_shared_page == NULL)
|
||||
if (vcpu == NULL || req == NULL || vcpu->vm->sw.io_shared_page == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
req_buf = (union vhm_request_buffer *)(vcpu->vm->sw.io_shared_page);
|
||||
|
||||
@@ -108,20 +109,22 @@ static void _get_req_info_(struct vhm_request *req, int *id, char *type,
|
||||
switch (req->type) {
|
||||
case REQ_PORTIO:
|
||||
(void)strcpy_s(type, 16, "PORTIO");
|
||||
if (req->reqs.pio_request.direction == REQUEST_READ)
|
||||
if (req->reqs.pio_request.direction == REQUEST_READ) {
|
||||
(void)strcpy_s(dir, 16, "READ");
|
||||
else
|
||||
} else {
|
||||
(void)strcpy_s(dir, 16, "WRITE");
|
||||
}
|
||||
*addr = req->reqs.pio_request.address;
|
||||
*val = req->reqs.pio_request.value;
|
||||
break;
|
||||
case REQ_MMIO:
|
||||
case REQ_WP:
|
||||
(void)strcpy_s(type, 16, "MMIO/WP");
|
||||
if (req->reqs.mmio_request.direction == REQUEST_READ)
|
||||
if (req->reqs.mmio_request.direction == REQUEST_READ) {
|
||||
(void)strcpy_s(dir, 16, "READ");
|
||||
else
|
||||
} else {
|
||||
(void)strcpy_s(dir, 16, "WRITE");
|
||||
}
|
||||
*addr = req->reqs.mmio_request.address;
|
||||
*val = req->reqs.mmio_request.value;
|
||||
break;
|
||||
|
@@ -37,8 +37,9 @@ uint16_t allocate_pcpu(void)
|
||||
uint16_t i;
|
||||
|
||||
for (i = 0U; i < phys_cpu_num; i++) {
|
||||
if (bitmap_test_and_set(i, &pcpu_used_bitmap) == 0)
|
||||
if (bitmap_test_and_set(i, &pcpu_used_bitmap) == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_CPU_ID;
|
||||
@@ -59,9 +60,10 @@ void add_vcpu_to_runqueue(struct vcpu *vcpu)
|
||||
int pcpu_id = vcpu->pcpu_id;
|
||||
|
||||
spinlock_obtain(&per_cpu(sched_ctx, pcpu_id).runqueue_lock);
|
||||
if (list_empty(&vcpu->run_list))
|
||||
if (list_empty(&vcpu->run_list)) {
|
||||
list_add_tail(&vcpu->run_list,
|
||||
&per_cpu(sched_ctx, pcpu_id).runqueue);
|
||||
}
|
||||
spinlock_release(&per_cpu(sched_ctx, pcpu_id).runqueue_lock);
|
||||
}
|
||||
|
||||
@@ -104,8 +106,9 @@ int need_reschedule(uint16_t pcpu_id)
|
||||
static void context_switch_out(struct vcpu *vcpu)
|
||||
{
|
||||
/* if it's idle thread, no action for switch out */
|
||||
if (vcpu == NULL)
|
||||
if (vcpu == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* cancel event(int, gp, nmi and exception) injection */
|
||||
cancel_event_injection(vcpu);
|
||||
@@ -124,8 +127,9 @@ static void context_switch_in(struct vcpu *vcpu)
|
||||
get_cpu_var(sched_ctx).curr_vcpu = vcpu;
|
||||
|
||||
/* if it's idle thread, no action for switch out */
|
||||
if (vcpu == NULL)
|
||||
if (vcpu == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
atomic_store(&vcpu->running, 1);
|
||||
/* FIXME:
|
||||
@@ -154,12 +158,13 @@ void default_idle(void)
|
||||
uint16_t pcpu_id = get_cpu_id();
|
||||
|
||||
while (1) {
|
||||
if (need_reschedule(pcpu_id) != 0)
|
||||
if (need_reschedule(pcpu_id) != 0) {
|
||||
schedule();
|
||||
else if (need_offline(pcpu_id) != 0)
|
||||
} else if (need_offline(pcpu_id) != 0) {
|
||||
cpu_dead(pcpu_id);
|
||||
else
|
||||
} else {
|
||||
__asm __volatile("pause" ::: "memory");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -55,8 +55,9 @@ int64_t hcall_initialize_trusty(struct vcpu *vcpu, uint64_t param)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (!initialize_trusty(vcpu, param))
|
||||
if (!initialize_trusty(vcpu, param)) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user