* [U-Boot] [PATCH] dfu: free entities when parsing fails
@ 2014-06-10 16:06 Stephen Warren
2014-06-18 6:15 ` Lukasz Majewski
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2014-06-10 16:06 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
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>
---
common/cmd_dfu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index a03538dabb37..433bddd5d2bd 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,
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] dfu: free entities when parsing fails
2014-06-10 16:06 [U-Boot] [PATCH] dfu: free entities when parsing fails Stephen Warren
@ 2014-06-18 6:15 ` Lukasz Majewski
0 siblings, 0 replies; 2+ messages in thread
From: Lukasz Majewski @ 2014-06-18 6:15 UTC (permalink / raw)
To: u-boot
Hi Stephen,
> From: Stephen Warren <swarren@nvidia.com>
>
> 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>
> ---
> common/cmd_dfu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index a03538dabb37..433bddd5d2bd 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,
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Test HW: Exynos4412 - Trats2
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-18 6:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 16:06 [U-Boot] [PATCH] dfu: free entities when parsing fails Stephen Warren
2014-06-18 6:15 ` Lukasz Majewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox