diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-07-26 21:27:15 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-07-28 08:09:08 +0200 |
commit | a2ad02526bbe35e8a9942dccb2145407463f2970 (patch) | |
tree | bf671143884d82797a85fa39798817f00d39f2ba /commands | |
parent | c6e3ef43d34dbb81f0632501387ec4d9573bd177 (diff) | |
download | barebox-a2ad02526bbe35e8a9942dccb2145407463f2970.tar.gz barebox-a2ad02526bbe35e8a9942dccb2145407463f2970.tar.xz |
commands: hab: check for error in imx_hab_device_locked_down
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@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20230726192718.911735-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/hab.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/commands/hab.c b/commands/hab.c index 97a1701fa5..8ae943a4c8 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"); |