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>
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);
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) {