On Wed, Jul 26, 2023 at 09:27:15PM +0200, Ahmad Fatoum wrote:
> 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 <[email protected]>
> ---
>  commands/hab.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Reply via email to