summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 5c0afec1544..f73d6eb0e2d 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -607,20 +607,6 @@ failure:
}
/**
- * bootefi_run_finish() - finish up after running an EFI test
- *
- * @loaded_image_info: Pointer to a struct which holds the loaded image info
- * @image_obj: Pointer to a struct which holds the loaded image object
- */
-static void bootefi_run_finish(struct efi_loaded_image_obj *image_obj,
- struct efi_loaded_image *loaded_image_info)
-{
- efi_restore_gd();
- free(loaded_image_info->load_options);
- efi_delete_handle(&image_obj->header);
-}
-
-/**
* do_efi_selftest() - execute EFI selftest
*
* Return: status code
@@ -638,7 +624,12 @@ static int do_efi_selftest(void)
/* Execute the test */
ret = EFI_CALL(efi_selftest(&image_obj->header, &systab));
- bootefi_run_finish(image_obj, loaded_image_info);
+ efi_restore_gd();
+ free(loaded_image_info->load_options);
+ if (ret != EFI_SUCCESS)
+ efi_delete_handle(&image_obj->header);
+ else
+ ret = efi_delete_handle(&image_obj->header);
return ret != EFI_SUCCESS;
}