[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-8c25db0a5a67986106aa3da7ce165ff961aa7847@git.kernel.org>
Date: Fri, 30 Nov 2018 01:57:30 -0800
From: tip-bot for Julien Thierry <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: arend.vanspriel@...adcom.com, luto@...nel.org, bp@...en8.de,
mingo@...nel.org, torvalds@...ux-foundation.org,
dave.hansen@...el.com, zhuyifei1999@...il.com,
natechancellor@...il.com, jonathanh@...dia.com,
bhsharma@...hat.com, julien.thierry@....com, hdegoede@...hat.com,
marc.zyngier@....com, sai.praneeth.prakhya@...el.com,
peterz@...radead.org, eric.snowberg@...cle.com,
ard.biesheuvel@...aro.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de, hpa@...or.com, matt@...eblueprint.co.uk,
joe@...ches.com, sedat.dilek@...il.com
Subject: [tip:efi/core] efi/fdt: Simplify the get_fdt() flow
Commit-ID: 8c25db0a5a67986106aa3da7ce165ff961aa7847
Gitweb: https://git.kernel.org/tip/8c25db0a5a67986106aa3da7ce165ff961aa7847
Author: Julien Thierry <julien.thierry@....com>
AuthorDate: Thu, 29 Nov 2018 18:12:22 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 30 Nov 2018 09:10:30 +0100
efi/fdt: Simplify the get_fdt() flow
Reorganize the get_fdt() lookup loop, clearly showing that:
- Nothing is done for table entries that do not have fdt_guid
- Once an entry with fdt_guid is found, break out of the loop
No functional changes.
Suggested-by: Joe Perches <joe@...ches.com>
Signed-off-by: Julien Thierry <julien.thierry@....com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Arend van Spriel <arend.vanspriel@...adcom.com>
Cc: Bhupesh Sharma <bhsharma@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: Eric Snowberg <eric.snowberg@...cle.com>
Cc: Hans de Goede <hdegoede@...hat.com>
Cc: Jon Hunter <jonathanh@...dia.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Marc Zyngier <marc.zyngier@....com>
Cc: Matt Fleming <matt@...eblueprint.co.uk>
Cc: Nathan Chancellor <natechancellor@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@...el.com>
Cc: Sedat Dilek <sedat.dilek@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: YiFei Zhu <zhuyifei1999@...il.com>
Cc: linux-efi@...r.kernel.org
Link: http://lkml.kernel.org/r/20181129171230.18699-4-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
drivers/firmware/efi/libstub/fdt.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index a3614f9b5f75..0dc7b4987cc2 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -370,23 +370,24 @@ void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size)
{
efi_guid_t fdt_guid = DEVICE_TREE_GUID;
efi_config_table_t *tables;
- void *fdt;
int i;
- tables = (efi_config_table_t *) sys_table->tables;
- fdt = NULL;
+ tables = (efi_config_table_t *)sys_table->tables;
for (i = 0; i < sys_table->nr_tables; i++) {
- if (efi_guidcmp(tables[i].guid, fdt_guid) == 0) {
- fdt = (void *) tables[i].table;
- if (fdt_check_header(fdt) != 0) {
- pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
- return NULL;
- }
- *fdt_size = fdt_totalsize(fdt);
- break;
+ void *fdt;
+
+ if (efi_guidcmp(tables[i].guid, fdt_guid) != 0)
+ continue;
+
+ fdt = (void *)tables[i].table;
+ if (fdt_check_header(fdt) != 0) {
+ pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
+ return NULL;
}
+ *fdt_size = fdt_totalsize(fdt);
+ return fdt;
}
- return fdt;
+ return NULL;
}
Powered by blists - more mailing lists