[PATCH 1/4] commands: hab: check for error in imx_hab_device_locked_down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



imx_hab_device_locked_down() reads efuses and that operation can fail.
Instead of assuming a failure means the efuses are non-zero, have the
hab command explicitly check for negative error codes.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 commands/hab.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/commands/hab.c b/commands/hab.c
index 97a1701fa551..8ae943a4c880 100644
--- a/commands/hab.c
+++ b/commands/hab.c
@@ -58,7 +58,13 @@ static int do_hab(int argc, char *argv[])
 			printf("%02x", srk[i]);
 		printf("\n");
 
-		if (imx_hab_device_locked_down())
+		ret = imx_hab_device_locked_down();
+		if (ret < 0) {
+			printf("failed to determine lockdown mode: '%pe'\n", ERR_PTR(ret));
+			return ret;
+		}
+
+		if (ret)
 			printf("secure mode\n");
 		else
 			printf("devel mode\n");
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux