[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH v2 4/9] x86/efi: tidy switch statement and address MISRA violation
Refactor the first clauses so that a violation of MISRA C Rule 16.2 is resolved (a switch label, "default" in this case, should be immediately enclosed in the compound statement of the switch). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. Convert fallthrough comments in other clauses to the pseudo-keyword while at it. No functional change. Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> --- There is some degree of duplication here between the default clause and the others, but I don't think there is a way to avoid it. --- xen/arch/x86/efi/efi-boot.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 8ea64e31cdc2..c4d452c482be 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -169,20 +169,22 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, switch ( desc->Type ) { + default: + type = E820_RESERVED; + break; case EfiBootServicesCode: case EfiBootServicesData: if ( map_bs ) { - default: type = E820_RESERVED; break; } - /* fall through */ + fallthrough; case EfiConventionalMemory: if ( !trampoline_phys && desc->PhysicalStart + len <= 0x100000 && len >= cfg.size && desc->PhysicalStart + len > cfg.addr ) cfg.addr = (desc->PhysicalStart + len - cfg.size) & PAGE_MASK; - /* fall through */ + fallthrough; case EfiLoaderCode: case EfiLoaderData: if ( desc->Attribute & EFI_MEMORY_RUNTIME ) -- 2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |