hv: fix 'No brackets to then/else'

- add missing brackets for 'if/else' statements based on MISRA-C
  requirements

v1 -> v2:
 * add brackets for each conditions in 'if' statements to improve
   the readability
 * modify 'ptdev_init' to make the logic clearer

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
This commit is contained in:
Shiqing Gao
2018-09-30 14:04:18 +08:00
committed by wenlingz
parent 71927f3c5b
commit 0317cfb2b6
23 changed files with 131 additions and 72 deletions

View File

@@ -38,8 +38,9 @@ int32_t hcall_sos_offline_cpu(struct vm *vm, uint64_t lapicid)
foreach_vcpu(i, vm, vcpu) {
if (vlapic_get_apicid(vcpu_vlapic(vcpu)) == lapicid) {
/* should not offline BSP */
if (vcpu->vcpu_id == BOOT_CPU_ID)
if (vcpu->vcpu_id == BOOT_CPU_ID) {
return -1;
}
pause_vcpu(vcpu, VCPU_ZOMBIE);
reset_vcpu(vcpu);
destroy_vcpu(vcpu);
@@ -237,8 +238,9 @@ int32_t hcall_reset_vm(uint16_t vmid)
{
struct vm *target_vm = get_vm_from_vmid(vmid);
if ((target_vm == NULL) || is_vm0(target_vm))
if ((target_vm == NULL) || is_vm0(target_vm)) {
return -1;
}
reset_vm(target_vm);
return 0;

View File

@@ -127,8 +127,9 @@ release_all_entries(struct vm *vm)
list_for_each_safe(pos, tmp, &ptdev_list) {
entry = list_entry(pos, struct ptdev_remapping_info,
entry_node);
if (entry->vm == vm)
if (entry->vm == vm) {
release_entry(entry);
}
}
}
@@ -191,8 +192,9 @@ ptdev_deactivate_entry(struct ptdev_remapping_info *entry)
void ptdev_init(void)
{
if (get_cpu_id() > 0)
if (get_cpu_id() != BOOT_CPU_ID) {
return;
}
INIT_LIST_HEAD(&ptdev_list);
spinlock_init(&ptdev_lock);

View File

@@ -39,8 +39,9 @@ void do_softirq(void)
while (true) {
nr = ffs64(*softirq_pending_bitmap);
if (nr >= NR_SOFTIRQS)
if (nr >= NR_SOFTIRQS) {
break;
}
bitmap_clear_lock(nr, softirq_pending_bitmap);
(*softirq_handlers[nr])(cpu_id);