Skip to content

Commit

Permalink
efi/x86: Replace #ifdefs with IS_ENABLED() checks
Browse files Browse the repository at this point in the history
When possible, IS_ENABLED() conditionals are preferred over #ifdefs,
given that the latter hide the code from the compiler entirely, which
reduces build test coverage when the option is not enabled.

So replace an instance in the x86 efi startup code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
  • Loading branch information
Ard Biesheuvel committed Feb 23, 2020
1 parent 14b60cc commit a570b06
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions arch/x86/platform/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,13 @@ int __init efi_memblock_x86_reserve_range(void)
if (efi_enabled(EFI_PARAVIRT))
return 0;

#ifdef CONFIG_X86_32
/* Can't handle data above 4GB at this time */
if (e->efi_memmap_hi) {
/* Can't handle firmware tables above 4GB on i386 */
if (IS_ENABLED(CONFIG_X86_32) && e->efi_memmap_hi > 0) {
pr_err("Memory map is above 4GB, disabling EFI.\n");
return -EINVAL;
}
pmap = e->efi_memmap;
#else
pmap = (e->efi_memmap | ((__u64)e->efi_memmap_hi << 32));
#endif
pmap = (phys_addr_t)(e->efi_memmap | ((u64)e->efi_memmap_hi << 32));

data.phys_map = pmap;
data.size = e->efi_memmap_size;
data.desc_size = e->efi_memdesc_size;
Expand Down

0 comments on commit a570b06

Please sign in to comment.