bootm: Handle errors consistently
PATCH v2 1/5 bootm: Handle errors consistently
A recent bootm fix left the error path incomplete. Reinstate this so that failures in bootm stages are handled properly.
---
Changes in v2:
- Correct checking in the no-error case
common/cmd_bootm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
common/cmd_bootm.c +1 -5
@@ -684,12 +684,8 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,if (!ret && (states &BOOTM_STATE_OS_GO )) { ret =boot_selected_os (argc, argv,BOOTM_STATE_OS_GO , images, boot_fn); -if (ret) - goto err; } -return ret; -/* Deal with any fallout */ err:if (iflag)
@@ -699,7 +695,7 @@ err:bootstage_error (BOOTSTAGE_ID_DECOMP_UNIMPL ); else if (ret == BOOTM_ERR_RESET) do_reset(cmdtp, flag, argc, argv); - else + else if (ret) puts("subcommand not supported\n");return ret;
Signature · 1 line
1.8.3
PATCH v2 1/5 bootm: Handle errors consistently
Quoted 7 lines · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so that failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error case
OK, this conflicts with the change I posted (and pushed later than I thought I had). Can you confirm the code is good in mainline now? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130705/b3309111/attachment.pgp>
PATCH v2 1/5 bootm: Handle errors consistently
Hi Tom,
Quoted 11 lines · Tom Rini
Quoted 7 lines · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so that failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error case
Quoted 4 lines
OK, this conflicts with the change I posted (and pushed later than I thought I had). Can you confirm the code is good in mainline now? Thanks!
It's close, but I think it still needs this near the end of do_bootm_states(), something like:
else if (ret == BOOTM_ERR_RESET) do_reset(cmdtp, flag, argc, argv); + else
if (ret) + puts("subcommand not supported\n"); return ret;
If you agree, I can prepare a patch as part of the bootz update.
Regards,
Simon
PATCH v2 1/5 bootm: Handle errors consistently
Quoted 20 lines · Simon Glass
Hi Tom,
Quoted 11 lines · Tom Rini
Quoted 7 lines · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so that failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error caseQuoted 4 lines
OK, this conflicts with the change I posted (and pushed later than I thought I had). Can you confirm the code is good in mainline now? Thanks!
Quoted 7 lines
It's close, but I think it still needs this near the end of
do_bootm_states(), something like:else if (ret ==
BOOTM_ERR_RESET)do_reset(cmdtp, flag, argc, argv); + else
if (ret) +puts("subcommand not supported\n"); return ret;If you agree, I can prepare a patch as part of the bootz update.
How do we get there in the code? When we do any subcalls is where we've got that puts already. Failures from that point on are either the OS bootm part failed (and return is > 0) or one of the BOOTM_ERR codes. Or did I miss a case still?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130705/41610e89/attachment.pgp>
PATCH v2 1/5 bootm: Handle errors consistently
Hi Tom,
Quoted 27 lines · Tom Rini
Quoted 7 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Tom Rini
Quoted 1 line · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so
that
Quoted 13 lines
Quoted 8 lines
Quoted 6 lines
failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error caseQuoted 4 lines
OK, this conflicts with the change I posted (and pushed later than I thought I had). Can you confirm the code is good in mainline now? Thanks!
Quoted 4 lines
It's close, but I think it still needs this near the end of
do_bootm_states(), something like:else if (ret ==
BOOTM_ERR_RESET)do_reset(cmdtp, flag, argc, argv); +else
Quoted 9 lines
Quoted 3 lines
if (ret) +
puts("subcommand not supported\n"); return ret;If you agree, I can prepare a patch as part of the bootz update.
How do we get there in the code? When we do any subcalls is where we've got that puts already. Failures from that point on are either the OS bootm part failed (and return is > 0) or one of the
BOOTM_ERRcodes. Or did I miss a case still?
I think this is when the boot_os function returns an error. At least the old code had quite a lot of printf()s for that case.
Regards,
Simon
PATCH v2 1/5 bootm: Handle errors consistently
Quoted 35 lines · Simon Glass
Hi Tom,
Quoted 31 lines · Tom Rini
Quoted 7 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Tom Rini
Quoted 1 line · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so
that
Quoted 13 lines
Quoted 8 lines
Quoted 6 lines
failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error caseQuoted 4 lines
OK, this conflicts with the change I posted (and pushed later than I thought I had). Can you confirm the code is good in mainline now? Thanks!
Quoted 4 lines
It's close, but I think it still needs this near the end of
do_bootm_states(), something like:else if (ret ==
BOOTM_ERR_RESET)do_reset(cmdtp, flag, argc, argv); +else
Quoted 3 lines
if (ret) +
puts("subcommand not supported\n"); return ret;If you agree, I can prepare a patch as part of the bootz update.
Quoted 8 lines
Quoted 5 lines
How do we get there in the code? When we do any subcalls is where we've got that puts already. Failures from that point on are either the OS bootm part failed (and return is > 0) or one of the
BOOTM_ERRcodes. Or did I miss a case still?I think this is when the
boot_osfunction returns an error. At least the old code had quite a lot of printf()s for that case.
We had a printf per subcommand before, and just a single one now. We didn't say the 'go' subcommand failed however, just what the function happened to print out.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130705/6801750d/attachment.pgp>
PATCH v2 1/5 bootm: Handle errors consistently
Hi Tom,
Quoted 47 lines · Tom Rini
Quoted 12 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 7 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Tom Rini
Quoted 1 line · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate
this so
Quoted 10 lines
Quoted 10 lines
that
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error caseOK, this conflicts with the change I posted (and pushed later than
I
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
thought I had). Can you confirm the code is good in mainline now? Thanks!
It's close, but I think it still needs this near the end of
do_bootm_states(), something like:else if (ret ==
BOOTM_ERR_RESET)do_reset(cmdtp, flag, argc, argv);+
Quoted 6 lines
Quoted 6 lines
else
Quoted 3 lines
if (ret) +
puts("subcommand not supported\n"); return ret;If you agree, I can prepare a patch as part of the bootz update.
How do we get there in the code? When we do any subcalls is where
we've
Quoted 2 lines
Quoted 2 lines
got that puts already. Failures from that point on are either the OS bootm part failed (and return is > 0) or one of the
BOOTM_ERRcodes.Or
Quoted 3 lines
Quoted 2 lines
did I miss a case still?
Quoted 7 lines
Quoted 2 lines
I think this is when the
boot_osfunction returns an error. At least the old code had quite a lot of printf()s for that case.We had a printf per subcommand before, and just a single one now. We didn't say the 'go' subcommand failed however, just what the function happened to print out.
Yes that looks right to me. But I believe that the GO command is not supposed to return, so it might be harmless to put the message there in all cases. If not, we can add a special case for GO.
Regards,
Simon
PATCH v2 1/5 bootm: Handle errors consistently
Quoted 54 lines · Simon Glass
Hi Tom,
Quoted 50 lines · Tom Rini
Quoted 12 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Rini
Quoted 7 lines · Simon Glass
Hi Tom,
Quoted 3 lines · Tom Rini
Quoted 1 line · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate
this so
Quoted 10 lines
Quoted 10 lines
that
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error caseOK, this conflicts with the change I posted (and pushed later than
I
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
thought I had). Can you confirm the code is good in mainline now? Thanks!
It's close, but I think it still needs this near the end of
do_bootm_states(), something like:else if (ret ==
BOOTM_ERR_RESET)do_reset(cmdtp, flag, argc, argv);+
Quoted 6 lines
Quoted 6 lines
else
Quoted 3 lines
if (ret) +
puts("subcommand not supported\n"); return ret;If you agree, I can prepare a patch as part of the bootz update.
How do we get there in the code? When we do any subcalls is where
we've
Quoted 2 lines
Quoted 2 lines
got that puts already. Failures from that point on are either the OS bootm part failed (and return is > 0) or one of the
BOOTM_ERRcodes.Or
Quoted 5 lines
Quoted 2 lines
did I miss a case still?
I think this is when the
boot_osfunction returns an error. At least the old code had quite a lot of printf()s for that case.
Quoted 7 lines
Quoted 3 lines
We had a printf per subcommand before, and just a single one now. We didn't say the 'go' subcommand failed however, just what the function happened to print out.
Yes that looks right to me. But I believe that the GO command is not supposed to return, so it might be harmless to put the message there in all cases. If not, we can add a special case for GO.
OK, I've been re-reading the before and after code, and at least wrt error messages and such, we're OK now. The 'GO' state is allowed to return 1 and usually does both for detectable errors (for example, FIT image for VxWorks, but a bad image) and "wth? we've been returned to from the OS". And I don't want to add a won't be reached string to the build given how badly we see compilers dealing with optimizing strings, along with the code bloat reason.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130708/5efee49e/attachment.pgp>
PATCH v2 1/5 bootm: Handle errors consistently
In reply to Simon GlassQuoted 29 lines · Simon Glass
A recent bootm fix left the error path incomplete. Reinstate this so that failures in bootm stages are handled properly.
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Correct checking in the no-error casecommon/cmd_bootm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)common/cmd_bootm.c +0
-4@@ -684,12 +684,8 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,if (!ret && (states &BOOTM_STATE_OS_GO )) { ret =boot_selected_os (argc, argv,BOOTM_STATE_OS_GO , images, boot_fn); -if (ret) - goto err; } -return ret; -/* Deal with any fallout */ err:if (iflag)
common/cmd_bootm.c err: · line 701
Quoted 8 lines
common/cmd_bootm.c +1
-1@@ -699,7 +695,7 @@ err:bootstage_error (BOOTSTAGE_ID_DECOMP_UNIMPL ); else if (ret == BOOTM_ERR_RESET) do_reset(cmdtp, flag, argc, argv); - else + else if (ret) puts("subcommand not supported\n");return ret;
Looking this part over again, BOOTM_STATE_OS_GO handles its own prints when returning 1, so we don't want to do the "subcommand not supported" part here (the other case is a BOOTM_ERR_RESET). But, trace does need to be covered and isn't by the "subcommand not supported" print. I'll make a v3 of this shortly and post.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130710/d75035b1/attachment.pgp>