mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
efi_loader: Uninstall the TCG2 protocol if logging s-crtm fails
Instead of just failing, clean up the installed config table and EventLog memory if logging an s-crtm event fails during the protocol installation Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Eliminate label 'out:' by using return. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
b76edf6b07
commit
97f446a8ff
1 changed files with 3 additions and 5 deletions
|
@ -1103,8 +1103,7 @@ efi_status_t efi_tcg2_register(void)
|
||||||
ret = platform_get_tpm2_device(&dev);
|
ret = platform_get_tpm2_device(&dev);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
log_warning("Unable to find TPMv2 device\n");
|
log_warning("Unable to find TPMv2 device\n");
|
||||||
ret = EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = efi_init_event_log();
|
ret = efi_init_event_log();
|
||||||
|
@ -1113,7 +1112,7 @@ efi_status_t efi_tcg2_register(void)
|
||||||
|
|
||||||
ret = efi_append_scrtm_version(dev);
|
ret = efi_append_scrtm_version(dev);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS)
|
||||||
goto out;
|
goto fail;
|
||||||
|
|
||||||
ret = efi_add_protocol(efi_root, &efi_guid_tcg2_protocol,
|
ret = efi_add_protocol(efi_root, &efi_guid_tcg2_protocol,
|
||||||
(void *)&efi_tcg2_protocol);
|
(void *)&efi_tcg2_protocol);
|
||||||
|
@ -1121,9 +1120,8 @@ efi_status_t efi_tcg2_register(void)
|
||||||
log_err("Cannot install EFI_TCG2_PROTOCOL\n");
|
log_err("Cannot install EFI_TCG2_PROTOCOL\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
tcg2_uninit();
|
tcg2_uninit();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue