summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/x86-stub.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2024-12-19 10:53:23 +0100
committerArd Biesheuvel <ardb@kernel.org>2025-01-14 08:34:25 +0100
commitc14bca3f7aa94fd8d3f5e621ce5b56535ef2396b (patch)
treecb9f0d9d43dad5727bbc521770bb0ef54517da37 /drivers/firmware/efi/libstub/x86-stub.c
parent144d52dd8fc83a082a275e1b663e7454d2b616a4 (diff)
efi/libstub: Use C99-style for loop to traverse handle buffer
Tweak the for_each_efi_handle() macro in order to avoid the need on the part of the caller to provide a loop counter variable. Also move efi_get_handle_num() to the callers, so that each occurrence can be replaced with the actual number returned by the simplified LocateHandleBuffer API. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/x86-stub.c')
-rw-r--r--drivers/firmware/efi/libstub/x86-stub.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 0c51d8307000..71173471faf6 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -124,7 +124,6 @@ static void setup_efi_pci(struct boot_params *params)
unsigned long size = 0;
struct setup_data *data;
efi_handle_t h;
- int i;
status = efi_bs_call(locate_handle, EFI_LOCATE_BY_PROTOCOL,
&pci_proto, NULL, &size, pci_handle);
@@ -150,7 +149,7 @@ static void setup_efi_pci(struct boot_params *params)
while (data && data->next)
data = (struct setup_data *)(unsigned long)data->next;
- for_each_efi_handle(h, pci_handle, size, i) {
+ for_each_efi_handle(h, pci_handle, efi_get_handle_num(size)) {
efi_pci_io_protocol_t *pci = NULL;
struct pci_setup_rom *rom;