Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932395AbcKAXJy (ORCPT ); Tue, 1 Nov 2016 19:09:54 -0400 Received: from g9t1613g.houston.hpe.com ([15.241.32.99]:35984 "EHLO g9t1613g.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753671AbcKAXJx (ORCPT ); Tue, 1 Nov 2016 19:09:53 -0400 Date: Tue, 1 Nov 2016 16:09:50 -0700 From: Linn Crosetto To: Eugene Korenevsky Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming Subject: Re: [PATCH] EFI loader: remove dead code Message-ID: <20161101230950.GD3567@oranje.usa.hp.com> References: <20161101173808.GA2682@vnote> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161101173808.GA2682@vnote> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1212 Lines: 34 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