EFI loader: remove dead code
PATCH 1/1 EFI loader: remove dead code
*e820ext is always NULL in 'alloc_e820ext()' (see the code of 'exit_boot()'). Therefore the 'if' condition is always false and the entire 'if' statement is pointless. Remove it.
--- arch/x86/boot/compressed/eboot.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/boot/compressed/eboot.c +0 -6
@@ -956,12 +956,6 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, size =sizeof (struct setup_data ) +sizeof (struct e820entry ) * nr_desc; -if (*e820ext) { -efi_call_early (free_pool, *e820ext); - *e820ext =NULL ; - *e820ext_size =0 ; - } - status =efi_call_early (allocate_pool,EFI_LOADER_DATA , size, (void **)e820ext);if (status ==EFI_SUCCESS )
Signature · 1 line
2.10.2
Quoted 13 lines · Eugene Korenevsky
*e820ext is always NULL in '
alloc_e820ext()' (see the code of 'exit_boot()'). Therefore the 'if' condition is always false and the entire 'if' statement is pointless. Remove it.--- arch/x86/boot/compressed/eboot.c | 6 ------ 1 file changed, 6 deletions(-)arch/x86/boot/compressed/eboot.c +0
-0
arch/x86/boot/compressed/eboot.c static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, · line 964
Quoted 9 lines
arch/x86/boot/compressed/eboot.c +0
-6@@ -956,12 +956,6 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, size =sizeof (struct setup_data ) +sizeof (struct e820entry ) * nr_desc; -if (*e820ext) { -efi_call_early (free_pool, *e820ext); - *e820ext =NULL ; - *e820ext_size =0 ; - } -
I agree with your reading of the code. On the other hand, alloc_e820ext() has no knowledge of the 'first' flag used in exit_boot_func() so the call to free provides some assurance that memory isn't leaked if the calling code is changed.
If the caller is responsible for freeing the memory in such a case, then alloc_e820ext() should at least return an error.
--
Linn
Applied your notice. Sent v2 patch.
--
Eugene