aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorRoy Franz <roy.franz@linaro.org>2013-09-22 15:45:38 -0700
committerMark Brown <broonie@linaro.org>2014-06-16 21:18:00 +0100
commit1e4247bf980786f472f3a693be2b72da94661c7e (patch)
tree4ad379c4faced55c64bf93be13bd1634d4edd409 /drivers/firmware
parent3cce6edd3ad71be57581f02cbc6538cf2d809584 (diff)
efi: Allow efi_free() to be called with size of 0
Make efi_free() safely callable with size of 0, similar to free() being callable with NULL pointers, and do nothing in that case. Remove size checks that this makes redundant. This also avoids some size checks in the ARM EFI stub code that will be added as well. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> (cherry picked from commit 0e1cadb05bba2293b4575c8cab275313d181d94f) Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index b314bf720272..fda510fa3579 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -255,6 +255,9 @@ static void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
{
unsigned long nr_pages;
+ if (!size)
+ return;
+
nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
efi_call_phys2(sys_table_arg->boottime->free_pages, addr, nr_pages);
}