[U-Boot] [PATCH 5/7] dfu:cmd: Support for DFU u-boot command

Mike Frysinger
2012-07-20T04:20:16Z

On Tuesday 03 July 2012 05:38:09 Lukasz Majewski wrote:
> --- /dev/null
> +++ b/common/cmd_dfu.c
>
> +int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

static

> +{
> + char *str_env = NULL, *env_bkp = NULL;

no need to assign NULL here. str_env should be const.

> + static char *s = "dfu";

no need to declare this static

> + int ret = 0;

no need to init to 0

> + env_bkp = strdup(str_env);
> + ret = dfu_config_entities(env_bkp, argv[1],
> + (int)simple_strtoul(argv[2], NULL, 10));
> + if (ret)
> + return CMD_RET_FAILURE;
> +
> + if (strcmp(argv[3], "list") == 0) {
> + dfu_show_entities();
> + dfu_free_entities();
> + free(env_bkp);
> + return CMD_RET_SUCCESS;

for these last three statements, you could just do "goto done" and put a done
label below ...

> +exit:
> + g_dnl_cleanup();

done:

> + dfu_free_entities();
> + free(env_bkp);
> +
> + return CMD_RET_SUCCESS;

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120720/7b1add72/attachment.pgp>