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@bugseng.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Nicola Vetrini authored and Andrew Cooper committed 2024-04-11 13:23:08 +01:00
1 parent 24f204748e
commit f509d39d5b
1 file changed
+11 -4
+11 -4
View File
@@ -169,20 +169,23 @@ 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 )
@@ -190,9 +193,13 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable,
else if ( desc->Attribute & EFI_MEMORY_WB )
type = E820_RAM;
else
case EfiUnusableMemory:
type = E820_UNUSABLE;
break;
case EfiUnusableMemory:
type = E820_UNUSABLE;
break;
case EfiACPIReclaimMemory:
type = E820_ACPI;
break;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.