aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2017-08-25 11:50:19 -0400
committerIngo Molnar <mingo@kernel.org>2017-08-26 03:20:33 -0400
commit6de47a5e371f75f80544986e6c9636211a2ae8af (patch)
tree684d8b5627dffb12e54b1ed26b63fd4cfb4b4714
parent23f0571c9fd184504f7a2f27011750e0ad99bb73 (diff)
efi/bgrt: Use efi_mem_type()
Avoid effectively open-coding the function. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jan Beulich <JBeulich@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170825155019.6740-6-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/firmware/efi/efi-bgrt.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c
index b58233e4ed71..50793fda7819 100644
--- a/drivers/firmware/efi/efi-bgrt.c
+++ b/drivers/firmware/efi/efi-bgrt.c
@@ -27,26 +27,6 @@ struct bmp_header {
27 u32 size; 27 u32 size;
28} __packed; 28} __packed;
29 29
30static bool efi_bgrt_addr_valid(u64 addr)
31{
32 efi_memory_desc_t *md;
33
34 for_each_efi_memory_desc(md) {
35 u64 size;
36 u64 end;
37
38 if (md->type != EFI_BOOT_SERVICES_DATA)
39 continue;
40
41 size = md->num_pages << EFI_PAGE_SHIFT;
42 end = md->phys_addr + size;
43 if (addr >= md->phys_addr && addr < end)
44 return true;
45 }
46
47 return false;
48}
49
50void __init efi_bgrt_init(struct acpi_table_header *table) 30void __init efi_bgrt_init(struct acpi_table_header *table)
51{ 31{
52 void *image; 32 void *image;
@@ -85,7 +65,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
85 goto out; 65 goto out;
86 } 66 }
87 67
88 if (!efi_bgrt_addr_valid(bgrt->image_address)) { 68 if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) {
89 pr_notice("Ignoring BGRT: invalid image address\n"); 69 pr_notice("Ignoring BGRT: invalid image address\n");
90 goto out; 70 goto out;
91 } 71 }