acrn-hypervisor/hypervisor/arch/x86
Shiqing Gao 71b047cb61 hv: fix 'Switch case not terminated with break'
MISRA-C requires that every switch case shall be terminated with break
to avoid the unintentional fall through.

The code will become redundant if we enforce this rule.
So, we will keep the current implementation for the following two cases.
1. The fall through is intentional.
2. The function is returned in the switch case.
    If we decide to eliminate the mutiple returns in one function later,
    this case would be handled properly at that time.

What this patch does:
- add the mssing break for the default case
- add the pre condition for some functions and remove the corresponding
  panic which will never happen since the function caller could guarantee
  the pre condition based on the code implementation

v1 -> v2:
 * remove the redundant cases above default in 'vlapic_get_lvtptr'
 * add the similar pre condition for 'lvt_off_to_idx' as
   'vlapic_get_lvtptr' since all the function callers could guarantee it
 * remove the assertion in 'lvt_off_to_idx' since the pre condition
   could guarantee that the assertion will never happen
 * add the similar pre condition for 'vpic_set_irqstate' as
   'vioapic_set_irqstate' since all the function callers could guarantee it
 * remove the assertion in 'vpic_set_irqstate' since the pre condition
   could guarantee that the assertion will never happen

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-09-25 11:10:44 +08:00
..
configs HV: config: add Kconfig and defconfigs for sbl & uefi 2018-06-08 17:21:13 +08:00
guest hv: fix 'Switch case not terminated with break' 2018-09-25 11:10:44 +08:00
assign.c hv: ioapic: convert some MACROs to inline functions 2018-09-25 11:09:56 +08:00
cpu_primary.S hv: mmu: cleanup mmu.h 2018-09-03 09:32:49 +08:00
cpu_save_boot_ctx.S hv: move boot_ctx offset definitions 2018-08-14 13:05:06 +08:00
cpu_state_tbl.c HV: Add const qualifiers where required 2018-08-17 10:02:12 +08:00
cpu.c hv: avoid memory leak in trampoline code preparing 2018-09-11 13:00:54 +08:00
cpuid.c hv:Replace vlapic pointer with instance in vcpu_arch 2018-09-12 09:20:07 +08:00
ept.c hv: ept: remove find_next_table 2018-09-03 09:32:49 +08:00
gdt.c HV: Removed the unused parameters and union from gdt 2018-08-27 09:40:25 +08:00
idt.S hv: Leave interrupts disabled during vmexit - ACRN partition mode 2018-08-31 08:48:47 +08:00
io.c hv: Replace dynamic memory allocation for I/O bitmaps 2018-09-12 09:20:07 +08:00
ioapic.c hv: ioapic: convert some MACROs to inline functions 2018-09-25 11:09:56 +08:00
irq.c hv: ioapic: convert some MACROs to inline functions 2018-09-25 11:09:56 +08:00
Kconfig HV: add Kconfig of CONSTANT_ACPI 2018-09-18 13:34:47 +08:00
lapic.c hv: remove unused MACROs 2018-09-18 09:43:43 +08:00
mmu.c hv:treewide:fix multiple MISRAC violations 2018-09-13 11:12:29 +08:00
mtrr.c hv: fix 'Switch case not terminated with break' 2018-09-25 11:10:44 +08:00
notify.c hv:Fix Implict conversion:actual to formal param 2018-09-18 13:09:39 +08:00
pagetable.c hv: treewide: fix 'Use of function like macro' 2018-09-11 10:49:48 +08:00
pm.c hv: pgtable: fix 'Use of function like macro' 2018-09-07 11:11:06 +08:00
retpoline-thunk.S license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00
static_checks.c hv: add compile time assert for static checks 2018-08-14 13:05:06 +08:00
timer.c hv:treewide:fix multiple MISRAC violations 2018-09-13 11:12:29 +08:00
trampoline.S hv: mmu: cleanup mmu.h 2018-09-03 09:32:49 +08:00
trusty.c HV: trusty: refine version checking when initializing trusty 2018-09-18 13:09:01 +08:00
virq.c hv: remove unused MACROs 2018-09-18 09:43:43 +08:00
vmexit.c hv:Replace vlapic pointer with instance in vcpu_arch 2018-09-12 09:20:07 +08:00
vmx_asm.S fix spec_ctrl msr save/restore 2018-08-16 16:24:13 +08:00
vmx.c hv:treewide:fix multiple MISRAC violations 2018-09-13 11:12:29 +08:00
vtd.c hv: init_iommu rework to enable IOMMU for partition mode ACRN 2018-09-20 11:14:07 +08:00
wakeup.S pm: use cpu_context for s3 save/restore 2018-08-07 09:55:13 +08:00