]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dfu: free entities when parsing fails
authorStephen Warren <swarren@nvidia.com>
Tue, 10 Jun 2014 16:06:41 +0000 (10:06 -0600)
committerMarek Vasut <marex@denx.de>
Wed, 25 Jun 2014 20:49:43 +0000 (22:49 +0200)
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>
common/cmd_dfu.c

index a03538dabb370c320815aa12637fae31e5eccd3c..433bddd5d2bdc83d9cf06fa943a44c08d9bba701 100644 (file)
@@ -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,