From patchwork Wed May 16 15:42:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914726 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; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="sQN4YKTd"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJt50yCrz9s2R for ; Thu, 17 May 2018 01:55:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CAF4BC21FD6; Wed, 16 May 2018 15:51:07 +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_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 0D00BC21FF1; Wed, 16 May 2018 15:44:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7B8CFC21FC1; Wed, 16 May 2018 15:43:15 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id DFC06C21FD1 for ; Wed, 16 May 2018 15:43:09 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id j186-v6so3075846ita.5 for ; Wed, 16 May 2018 08:43:09 -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=2Mh1OOlGi1ycN99M29C+M1g5QjjnVI7QHQ5Miussg4Q=; b=sQN4YKTdDYulfR9TgUMKdBsMy7T4Mtvczwfp5JhrRIq3CgB3+pzR2zIgji3hlbRc1Y LV5+yqEKtTiWQsh4HJnD0K3rZ8a/7JNCOle20WcoPd3spSLsVI86lAQnNpwbn2+TqBfx c7NRo1hPJAV1jpCZ54Zj/PxACg1BVfXNYhu8LVWXfxlOjscFgq96gotPEEt8yrnu9ATw aypgUazTWGwofY6xHfzgATfo3P8nqFYabEEGDGnbrYiAoTjLUVWAMSgDqh83o82HLclZ Dg8Lu1qXTFAF2YwIAhtUwe8gCdCtTWJJ/O1GUAUQOZ0Px6o6+IKI/4fzjS9pYczKlYd7 z3IA== 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=2Mh1OOlGi1ycN99M29C+M1g5QjjnVI7QHQ5Miussg4Q=; b=tVfT9r1actK3pn7ktKDWvFYStGru/Qmy3DvQzt6L5izzpA7T18fd6abe+cgfLpME8K kclWG9tVOT4V3YgMIWQINIp2UKiK4O3gEk5Loi4Cu72luS70yesS+wmgXb5HyrP4dqya GKXJG5iRyFg79+91QAMtxk5dY1r1BOCt6Ruf5qNUmpgIzj8deVvVSOivPMNrSEdEcqKu BOVZrIofa6zC7cSNI6w/1PJGw2JYHEQlG/FS/fM+T9NZRTz2E2pVHFRSOy64Mz2LLMpr f2moGdFA7PcHy1niv7ShF+K6sTXPTTVeRCLR+6Ar9XirTCfdwHTmOh3Ar7odDsdFtfpX BFxQ== X-Gm-Message-State: ALKqPwcEGlyoJeLABhM5GrGSmYX6tVAD7EBvUHdLmZdrc43HKc/b2QFs x/51Wm6lFeT9vQ9nzoD7K0geXA== X-Google-Smtp-Source: AB8JxZqpSF2+Q5hk2Yx/OdjHXYot49B9NvLWUDT5VK/6S1xb3yClyQNWjK8JUtjNLnkNm+CElgCkNQ== X-Received: by 2002:a24:4092:: with SMTP id n140-v6mr1487463ita.139.1526485388350; Wed, 16 May 2018 08:43:08 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id v18-v6sm1768352ita.19.2018.05.16.08.43.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:07 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 15FEB140208; Wed, 16 May 2018 09:43:07 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:33 -0600 Message-Id: <20180516154233.21457-17-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 16/16] efi: Rename bootefi_test_finish() to bootefi_run_finish() 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" This function can be used from do_bootefi_exec() so that we use mostly the same code for a normal EFI application and an EFI test. Rename the function and use it in both places. Signed-off-by: Simon Glass --- Changes in v4: - Rebase to master Changes in v3: - Add new patch to rename bootefi_test_finish() to bootefi_run_finish() Changes in v2: None cmd/bootefi.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 23f05aa867a..00a94fc8560 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -268,6 +268,20 @@ static efi_status_t bootefi_run_prepare(struct efi_loaded_image *image, return 0; } +/** + * bootefi_run_finish() - finish up after running an EFI test + * + * @image: Pointer to a struct which holds the loaded image info + * @obj: Pointer to a struct which holds the loaded image object + */ +static void bootefi_run_finish(struct efi_loaded_image *image, + struct efi_object *obj) +{ + efi_restore_gd(); + free(image->load_options); + list_del(&obj->link); +} + /* * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. @@ -350,8 +364,7 @@ static efi_status_t do_bootefi_exec(void *efi, ret = efi_do_enter(obj.handle, &systab, entry); exit: - /* image has returned, loaded-image obj goes *poof*: */ - list_del(&obj.link); + bootefi_run_finish(&image, &obj); return ret; } @@ -383,20 +396,6 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, bootefi_image_path); } -/** - * bootefi_test_finish() - finish up after running an EFI test - * - * @image: Pointer to a struct which holds the loaded image info - * @obj: Pointer to a struct which holds the loaded image object - */ -static void bootefi_test_finish(struct efi_loaded_image *image, - struct efi_object *obj) -{ - efi_restore_gd(); - free(image->load_options); - list_del(&obj->link); -} - static int do_bootefi_bootmgr_exec(void) { struct efi_device_path *device_path, *file_path; @@ -480,7 +479,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_FAILURE; ret = efi_test(&image, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); if (ret) { printf("Test failed: err=%d\n", ret); return CMD_RET_FAILURE; @@ -497,7 +496,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Execute the test */ r = efi_selftest(obj.handle, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); return r != EFI_SUCCESS; } else #endif