[PATCH v2 2/4] x86/boot/compressed: Clean up EFI RSDP lookup in efi_get_rsdp_addr()

From: Thorsten Blum

Date: Wed Jun 24 2026 - 08:04:18 EST


Mark __efi_get_rsdp_addr() as __maybe_unused and remove the unused ret
variable. In efi_get_rsdp_addr(), remove the unused nr_tables variable
and inline variables that are only used for simple if checks.

Since efi_get_conf_table() already calls efi_get_system_table(), drop
the redundant efi_get_system_table() call and keep a single error path.

Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
arch/x86/boot/compressed/acpi.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index f196b1d1ddf8..c6e1db48229c 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -21,12 +21,11 @@
*/
struct mem_vector immovable_mem[MAX_NUMNODES*2];

-static acpi_physical_address
+static acpi_physical_address __maybe_unused
__efi_get_rsdp_addr(unsigned long cfg_tbl_pa, unsigned int cfg_tbl_len)
{
#ifdef CONFIG_EFI
unsigned long rsdp_addr;
- int ret;

/*
* Search EFI system tables for RSDP. Preferred is ACPI_20_TABLE_GUID to
@@ -53,21 +52,12 @@ static acpi_physical_address efi_get_rsdp_addr(void)
#ifdef CONFIG_EFI
unsigned long cfg_tbl_pa = 0;
unsigned int cfg_tbl_len;
- unsigned long systab_pa;
- unsigned int nr_tables;
- enum efi_type et;
- int ret;

- et = efi_get_type(boot_params_ptr);
- if (et == EFI_TYPE_NONE)
+ if (efi_get_type(boot_params_ptr) == EFI_TYPE_NONE)
return 0;

- systab_pa = efi_get_system_table(boot_params_ptr);
- if (!systab_pa)
- error("EFI support advertised, but unable to locate system table.");
-
- ret = efi_get_conf_table(boot_params_ptr, &cfg_tbl_pa, &cfg_tbl_len);
- if (ret || !cfg_tbl_pa)
+ if (efi_get_conf_table(boot_params_ptr, &cfg_tbl_pa, &cfg_tbl_len) ||
+ !cfg_tbl_pa)
error("EFI config table not found.");

return __efi_get_rsdp_addr(cfg_tbl_pa, cfg_tbl_len);