[PATCH 02/14] bootm: Change incorrect 'unsupported' error

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Sep 9 17:33:14 CEST 2022



Am 9. September 2022 17:17:49 MESZ schrieb Simon Glass <sjg at chromium.org>:
>At present when bootm fails, it says:
>
>    subcommand not supported
>
>and then prints help for the bootm command. This is not very useful, since
>generally the error is related to something else, such as fixups failing.
>It is quite confusing to see this in a test run.
>
>Change the error and show the error code.
>
>We could update the OS functions to return -ENOSYS when they do not
>support the bootm subcommand. But this involves some thought since this is
>arch-specific code and proper errno error codes are not always returned.
>Also, with the code as is, all required subcommands are of course
>supported - a problem would only come if someone added a new one or
>removed support for one from an existing OS. Therefore it seems better to
>leave that sort of effort for when our bootm tests are improved.
>
>Signed-off-by: Simon Glass <sjg at chromium.org>
>---
>
> boot/bootm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/boot/bootm.c b/boot/bootm.c
>index f6713807fda..ed6b489c4b3 100644
>--- a/boot/bootm.c
>+++ b/boot/bootm.c
>@@ -790,7 +790,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
> 
> 	/* Check for unsupported subcommand. */
> 	if (ret) {
>-		puts("subcommand not supported\n");
>+		printf("subcommand failed (err=%d)\n", ret);

Return codes are only interpretable by developers. We have a function to convert errno to a string.

For the average user it would be helpful to know which  (sub-)command failed especially if this boot command is executed in an automated way.

Best regards

Heinrich 

> 		return ret;
> 	}
> 


More information about the U-Boot mailing list