linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] EFI loader: remove dead code
@ 2016-11-01 17:38 Eugene Korenevsky
  2016-11-01 23:09 ` Linn Crosetto
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Korenevsky @ 2016-11-01 17:38 UTC (permalink / raw)
  To: linux-kernel, linux-efi; +Cc: Matt Fleming, Linn Crosetto

*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(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index cc69e37..edfd4d6 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -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)
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI loader: remove dead code
  2016-11-01 17:38 [PATCH] EFI loader: remove dead code Eugene Korenevsky
@ 2016-11-01 23:09 ` Linn Crosetto
  2016-11-02  5:55   ` Eugene Korenevsky
  0 siblings, 1 reply; 3+ messages in thread
From: Linn Crosetto @ 2016-11-01 23:09 UTC (permalink / raw)
  To: Eugene Korenevsky; +Cc: linux-kernel, linux-efi, Matt Fleming

On Tue, Nov 01, 2016 at 08:38:08PM +0300, Eugene Korenevsky wrote:
> *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(-)
> 
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index cc69e37..edfd4d6 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI loader: remove dead code
  2016-11-01 23:09 ` Linn Crosetto
@ 2016-11-02  5:55   ` Eugene Korenevsky
  0 siblings, 0 replies; 3+ messages in thread
From: Eugene Korenevsky @ 2016-11-02  5:55 UTC (permalink / raw)
  To: Linn Crosetto; +Cc: linux-kernel, linux-efi, Matt Fleming

Applied your notice. Sent v2 patch.

--
Eugene

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-02  5:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-01 17:38 [PATCH] EFI loader: remove dead code Eugene Korenevsky
2016-11-01 23:09 ` Linn Crosetto
2016-11-02  5:55   ` Eugene Korenevsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).