diff mbox series

[v3,25/25] arm: imx: hab: Print HAB event log only after calling ROM

Message ID 1514596142-22050-34-git-send-email-bryan.odonoghue@linaro.org
State Superseded
Headers show
Series None | expand

Commit Message

Bryan O'Donoghue Dec. 30, 2017, 1:09 a.m. UTC
The current flow of authenticate_image() will print the HAB event log even
if we reject an element of the IVT header before ever calling into the ROM.
This can be confusing.

This patch changes the flow of the code so that the HAB event log is only
printed out if we have called into the ROM and received some sort of status
code.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Suggested-by: Cc: Breno Matheus Lima <brenomatheus@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Sven Ebenfeld <sven.ebenfeld@gmail.com>
Cc: George McCollister <george.mccollister@gmail.com>
---
 arch/arm/mach-imx/hab.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 5da09d5..79ee4d5 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -521,14 +521,14 @@  int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
 
 	if (hab_rvt_entry() != HAB_SUCCESS) {
 		puts("hab entry function fail\n");
-		goto hab_caam_clock_disable;
+		goto hab_exit_failure_print_status;
 	}
 
 	status = hab_rvt_check_target(HAB_TGT_MEMORY, (void *)ddr_start, bytes);
 	if (status != HAB_SUCCESS) {
 		printf("HAB check target 0x%08x-0x%08x fail\n",
 		       ddr_start, ddr_start + bytes);
-		goto hab_caam_clock_disable;
+		goto hab_exit_failure_print_status;
 	}
 #ifdef DEBUG
 	printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr);
@@ -601,12 +601,14 @@  int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
 		load_addr = 0;
 	}
 
-hab_caam_clock_disable:
-	hab_caam_clock_enable(0);
-
+hab_exit_failure_print_status:
 #if !defined(CONFIG_SPL_BUILD)
 	get_hab_status();
 #endif
+
+hab_caam_clock_disable:
+	hab_caam_clock_enable(0);
+
 	if (load_addr != 0)
 		result = 0;