diff options
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/esrt.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index c47e0c6ec00f..1ab80e06e7c5 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -279,6 +279,7 @@ void __init efi_esrt_init(void) } memcpy(&tmpesrt, va, sizeof(tmpesrt)); + early_memunmap(va, size); if (tmpesrt.fw_resource_version == 1) { entry_size = sizeof (*v1_entries); @@ -291,7 +292,7 @@ void __init efi_esrt_init(void) if (tmpesrt.fw_resource_count > 0 && max - size < entry_size) { pr_err("ESRT memory map entry can only hold the header. (max: %zu size: %zu)\n", max - size, entry_size); - goto err_memunmap; + return; } /* @@ -304,7 +305,7 @@ void __init efi_esrt_init(void) if (tmpesrt.fw_resource_count > 128) { pr_err("ESRT says fw_resource_count has very large value %d.\n", tmpesrt.fw_resource_count); - goto err_memunmap; + return; } /* @@ -315,18 +316,10 @@ void __init efi_esrt_init(void) if (max < size + entries_size) { pr_err("ESRT does not fit on single memory map entry (size: %zu max: %zu)\n", size, max); - goto err_memunmap; + return; } - /* remap it with our (plausible) new pages */ - early_memunmap(va, size); size += entries_size; - va = early_memremap(efi.esrt, size); - if (!va) { - pr_err("early_memremap(%p, %zu) failed.\n", (void *)efi.esrt, - size); - return; - } esrt_data = (phys_addr_t)efi.esrt; esrt_data_size = size; @@ -336,8 +329,6 @@ void __init efi_esrt_init(void) efi_mem_reserve(esrt_data, esrt_data_size); pr_debug("esrt-init: loaded.\n"); -err_memunmap: - early_memunmap(va, size); } static int __init register_entries(void) |