* [U-Boot] [PATCH] do_smhload: fix return code
@ 2017-03-02 17:45 Ryan Harkin
2017-03-03 8:50 ` Linus Walleij
2017-03-10 15:10 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Ryan Harkin @ 2017-03-02 17:45 UTC (permalink / raw)
To: u-boot
do_smhload was using a ulong to store the return value from
smh_load_file. That returns an int, where -1 indicates an error. As a
ulong will never be negative, smh_load_file errors were not detected and
so_smhload always returned zero.
Also, when errors were spotted, do_smhload was returning 1, rather than
the enumeration CMD_RET_FAILURE (which is also 1).
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
---
arch/arm/lib/semihosting.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index e32ad90..415ac89 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -186,7 +186,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc == 3 || argc == 4) {
ulong load_addr;
ulong end_addr = 0;
- ulong ret;
+ int ret;
char end_str[64];
load_addr = simple_strtoul(argv[2], NULL, 16);
@@ -195,7 +195,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ret = smh_load_file(argv[1], load_addr, &end_addr);
if (ret < 0)
- return 1;
+ return CMD_RET_FAILURE;
/* Optionally save returned end to the environment */
if (argc == 4) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] do_smhload: fix return code
2017-03-02 17:45 [U-Boot] [PATCH] do_smhload: fix return code Ryan Harkin
@ 2017-03-03 8:50 ` Linus Walleij
2017-03-10 15:10 ` [U-Boot] " Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-03-03 8:50 UTC (permalink / raw)
To: u-boot
On Thu, Mar 2, 2017 at 6:45 PM, Ryan Harkin <ryan.harkin@linaro.org> wrote:
> do_smhload was using a ulong to store the return value from
> smh_load_file. That returns an int, where -1 indicates an error. As a
> ulong will never be negative, smh_load_file errors were not detected and
> so_smhload always returned zero.
>
> Also, when errors were spotted, do_smhload was returning 1, rather than
> the enumeration CMD_RET_FAILURE (which is also 1).
>
> Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] do_smhload: fix return code
2017-03-02 17:45 [U-Boot] [PATCH] do_smhload: fix return code Ryan Harkin
2017-03-03 8:50 ` Linus Walleij
@ 2017-03-10 15:10 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2017-03-10 15:10 UTC (permalink / raw)
To: u-boot
On Thu, Mar 02, 2017 at 05:45:16PM +0000, Ryan Harkin wrote:
> do_smhload was using a ulong to store the return value from
> smh_load_file. That returns an int, where -1 indicates an error. As a
> ulong will never be negative, smh_load_file errors were not detected and
> so_smhload always returned zero.
>
> Also, when errors were spotted, do_smhload was returning 1, rather than
> the enumeration CMD_RET_FAILURE (which is also 1).
>
> Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170310/1047c941/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-10 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 17:45 [U-Boot] [PATCH] do_smhload: fix return code Ryan Harkin
2017-03-03 8:50 ` Linus Walleij
2017-03-10 15:10 ` [U-Boot] " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.