diff options
author | Stephen Warren <swarren@nvidia.com> | 2014-06-10 10:06:41 -0600 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2014-06-25 22:49:43 +0200 |
commit | afb8e71caea6784e8c3ff18cab7f27c46511878a (patch) | |
tree | df35b19e6f2ae6bddf9a15553e8529a6431a2ba0 /common/cmd_dfu.c | |
parent | 08ebd467c8649493404e5cc513abd096076c733e (diff) | |
download | u-boot-imx-afb8e71caea6784e8c3ff18cab7f27c46511878a.zip u-boot-imx-afb8e71caea6784e8c3ff18cab7f27c46511878a.tar.gz u-boot-imx-afb8e71caea6784e8c3ff18cab7f27c46511878a.tar.bz2 |
dfu: free entities when parsing fails
When dfu_init_env_entities() fails part-way through, some entities may
have been added to dfu_list. These are only removed by dfu_free_entities().
If that function isn't called, those stale entities will still exist the
next time dfu_init_env_entities() is called, leading to confusion. Fix
do_dfu() to ensure that dfu_free_entities() is always called, to avoid
this confusion.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'common/cmd_dfu.c')
-rw-r--r-- | common/cmd_dfu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index a03538d..433bddd 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -27,8 +27,9 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = dfu_init_env_entities(interface, simple_strtoul(devstring, NULL, 10)); if (ret) - return ret; + goto done; + ret = CMD_RET_SUCCESS; if (argc > 4 && strcmp(argv[4], "list") == 0) { dfu_show_entities(); goto done; @@ -61,7 +62,7 @@ done: if (dfu_reset()) run_command("reset", 0); - return CMD_RET_SUCCESS; + return ret; } U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu, |