From patchwork Sun Sep 17 22:59:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 814721 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="lelRl1/E"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xwQhh2t9nz9s7c for ; Mon, 18 Sep 2017 09:44:20 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 30C77C21E9B; Sun, 17 Sep 2017 23:44:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1AC59C21DA9; Sun, 17 Sep 2017 23:00:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7E1DFC21D80; Sun, 17 Sep 2017 23:00:53 +0000 (UTC) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by lists.denx.de (Postfix) with ESMTPS id C7662C21D80 for ; Sun, 17 Sep 2017 22:59:34 +0000 (UTC) Received: by mail-io0-f176.google.com with SMTP id v36so14911361ioi.1 for ; Sun, 17 Sep 2017 15:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ikM2QFH7wVImbdhfRjWFnRWg3Uc/i+hU3aGT1bvvUVk=; b=lelRl1/E3j7HsTVqjjN8exRzeXR4fT3a2bYe66kIRVuctAA5YiM99g/H9jmymp8FqJ wqAuTfW7IBxpjEmNvz9dEk8KeYA/JjVgBg6GffySYPuxah76s7wpyYpA/kD1IWCNltwe 7eGQmlLe5c+YHKRNJGjStjJQzAO5Yy5F1NFU5nsPAa520V84aBYN1EI00ECnL494VjAn UD/Ftjha/manM7ORUhJywuDGPVSNzg2+ozZ37iVZdd+M0ke4ewZVscIguJpHcgB/OXSi XLzxir8D9L0XE0GlT+inDoru/H4UhwqX80dlEgKww0dQIF0UAbLcvH2zEi3n592zqvY1 5tqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ikM2QFH7wVImbdhfRjWFnRWg3Uc/i+hU3aGT1bvvUVk=; b=gjk8moldH5rlnGrbutKiLy4+xsHHwhH3/0ZmZlrrZgGAbaM4uoQ40WxdyY+J1tPtGL PbDTmVUNPr7ZoCqlM4/Ig2CYjjUn5h6JwyJ0eAD1slPIAkDLXtQBycxwdp1frNmiYnXt o4s4KKC0HUCr5stGo7myWYjKMLbVVWbiSTzfyNWnzOvxjfPnAzitc2N1p0JOjoLa7qUY XdhVsE7znJzWioiRN8zEjhwGxTuzgEK27adIu/v/E/vXM1NNJ8mrtnrwBel7r2nV0tR0 BZiMMrzkpEOpgu6uB4nRG+yK5CrizIo45Os8KnMA5Rtimy4fC8RxpGN0NC8JGgiuX0fp 9hsQ== X-Gm-Message-State: AHPjjUi31b5ychdPbAAH7m+4Q0cGkJad3dX8YJOus8N06cSh0e+eOSpK WW8LtzB2L6v9FLf3 X-Google-Smtp-Source: AOwi7QCMYxImZyjH1hPKvlOmKujpQgLmvDqSrjRmmhUGKPheqI+EzCRUyFLTI//ODDLejewN45eWvA== X-Received: by 10.202.75.211 with SMTP id y202mr4455969oia.140.1505689173490; Sun, 17 Sep 2017 15:59:33 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.101.164.89]) by smtp.gmail.com with ESMTPSA id v204sm6882748oie.17.2017.09.17.15.59.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Sep 2017 15:59:32 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id CE56014052F; Sun, 17 Sep 2017 16:59:31 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 17 Sep 2017 16:59:13 -0600 Message-Id: <20170917225927.117917-3-sjg@chromium.org> X-Mailer: git-send-email 2.14.1.690.gbb1197296e-goog In-Reply-To: <20170917225927.117917-1-sjg@chromium.org> References: <20170917225927.117917-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt Subject: [U-Boot] [PATCH 02/16] efi: Move the init check inside efi_init_obj_list() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Rather than having the caller check this variable and the callee set it, move all access to the variable inside the function. This reduces the logic needed to call efi_init_obj_list(). Signed-off-by: Simon Glass --- cmd/bootefi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index abfab8fa98..2c9d31c5eb 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -109,6 +109,8 @@ static struct efi_object bootefi_device_obj = { /* Initialize and populate EFI object list */ static void efi_init_obj_list(void) { + if (efi_obj_list_initalized) + return; efi_obj_list_initalized = 1; list_add_tail(&loaded_image_info_obj.link, &efi_obj_list); @@ -256,8 +258,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt) return -ENOENT; /* Initialize and populate EFI object list */ - if (!efi_obj_list_initalized) - efi_init_obj_list(); + efi_init_obj_list(); /* Call our payload! */ debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry); @@ -311,8 +312,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) */ efi_save_gd(); /* Initialize and populate EFI object list */ - if (!efi_obj_list_initalized) - efi_init_obj_list(); + efi_init_obj_list(); loaded_image_info.device_handle = bootefi_device_path; loaded_image_info.file_path = bootefi_image_path; return efi_selftest(&loaded_image_info, &systab);