From patchwork Tue Nov 6 22:57:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 993975 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42qQ5v1Ht1z9sCm for ; Wed, 7 Nov 2018 10:01:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 88A0AC2293F; Tue, 6 Nov 2018 22:59:29 +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 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 6D381C22859; Tue, 6 Nov 2018 22:58:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EADB1C2294C; Tue, 6 Nov 2018 22:58:02 +0000 (UTC) Received: from mail-it1-f202.google.com (mail-it1-f202.google.com [209.85.166.202]) by lists.denx.de (Postfix) with ESMTPS id 8832EC22874 for ; Tue, 6 Nov 2018 22:57:58 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id y144-v6so18838353itc.5 for ; Tue, 06 Nov 2018 14:57:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Bhqc4g5uuMYE2FytmOJ+Yzve6xzlJfzjRmEj0H26uq0=; b=AU0s8KCv37XbbxQhknLQeaGNlSr9S5cqGeoib/uS3qvP2aoVPtpqshngHyHOava9BL KrPN9msGLufjTj4RWfZ0zYnFoejc3/TK2hiVAZwWjYc5SSlq91XDPsitSpI/azs5QB34 US76de/ViO/K7INnxd2iqdDyqfCeNbov4eHRcLrUDdt//xP29vXuDMcvOgiAe7U9RJfl IJXThQbzaIMjBLOsMZgjlGO8l6bq+v+qRNssp/a56ne8axXm9rNUwoA0u2/FOHK1s52i iLwk22AjW7vHMW/P1qz0VVPwYeA5ui/zUti9gpvm+lifCxBxeHj83kDe7v0flqFZynld e+yw== X-Gm-Message-State: AGRZ1gLSg9fpYPkRJxcLfgIytB6I4buY5mE0Dgh9kEnV2k5xKBfs9CoB J9s69v948qwrUlRtZdqwI8VEnrQ= X-Google-Smtp-Source: AJdET5e/jjJsZBu4cpH5C7lypz1isLapTWWaXSwtz5KCgHrw9lrxfC9ZWslIa5v01DKJNcaUF34iv2o= X-Received: by 2002:a05:660c:743:: with SMTP id a3mr2892466itl.36.1541545077623; Tue, 06 Nov 2018 14:57:57 -0800 (PST) Date: Tue, 6 Nov 2018 15:57:44 -0700 In-Reply-To: <20181106225744.139945-1-sjg@chromium.org> Message-Id: <20181106225744.139945-7-sjg@chromium.org> Mime-Version: 1.0 References: <20181106225744.139945-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog From: Simon Glass To: U-Boot Mailing List Cc: Alexander Graf Subject: [U-Boot] [PATCH v12 6/6] 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: , 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 v12: None Changes in v11: - Drop patches previously applied Changes in v9: None Changes in v7: - Drop patch "efi: Init the 'rows' and 'cols' variables" - Drop patches previous applied Changes in v5: - Rebase to master Changes in v4: - Rebase to master Changes in v3: - Add new patch to rename bootefi_test_finish() to bootefi_run_finish() cmd/bootefi.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 779c1f63fa8..7a077995dc5 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -351,6 +351,20 @@ static efi_status_t bootefi_run_prepare(const char *load_options_path, 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_loaded_image_obj *obj) +{ + efi_restore_gd(); + free(image->load_options); + efi_delete_handle(&obj->parent); +} + /** * do_bootefi_exec() - execute EFI binary * @@ -468,8 +482,7 @@ static efi_status_t do_bootefi_exec(void *efi, exit: /* image has returned, loaded-image obj goes *poof*: */ - if (obj) - efi_delete_handle(&obj->parent); + bootefi_run_finish(image, obj); if (mem_handle) efi_delete_handle(mem_handle); @@ -507,20 +520,6 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image **imagep, return bootefi_run_prepare(load_options_path, bootefi_device_path, bootefi_image_path, imagep, objp); } - -/** - * 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_loaded_image_obj *obj) -{ - efi_restore_gd(); - free(image->load_options); - efi_delete_handle(&obj->parent); -} #endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ static int do_bootefi_bootmgr_exec(void) @@ -605,7 +604,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Execute the test */ r = efi_selftest(obj, &systab); - bootefi_test_finish(image_prot, obj); + bootefi_run_finish(image_prot, obj); return r != EFI_SUCCESS; } else #endif