[PATCH 1/3] hab: bail out with error when SRK hash write fails

Sascha Hauer s.hauer at pengutronix.de
Mon Jul 15 05:36:12 PDT 2024


When we fail to write fuses during writing the SRK hash, then bail
out with an error instead of silently ignoring it.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/hab/hab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index 28a091841a..288f440bd2 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -280,9 +280,11 @@ static int imx_ahab_write_srk_hash(const u8 *__newsrk, unsigned flags)
 
 	for (i = 0; i < 32 / sizeof(u32); i++) {
 		ret = ele_write_fuse(0x80 + i, newsrk[i], false, &resp);
-		if (ret)
+		if (ret) {
 			pr_err("Writing fuse index 0x%02x failed with %d, response 0x%08x\n",
 			       i, ret, resp);
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.39.2




More information about the barebox mailing list