[U-Boot] [PATCH 3/7] dfu: DFU backend implementation
Mike Frysinger
vapier at gentoo.org
Fri Jul 20 06:32:00 CEST 2012
On Tuesday 03 July 2012 05:38:07 Lukasz Majewski wrote:
> + puts("UPLOAD ... done\n");
> + puts("Ctrl+C to exit ...\n");
combine into a single puts() ?
> +static int dfu_fill_entity(struct dfu_entity *dfu, char* s, int alt,
> + char *interface, int num)
> +{
> + char *st = NULL;
> + int n = 0;
> +
> + debug("%s: %s interface: %s num: %d\n", __func__, s, interface, num);
> +
> + st = dfu_extract_token(&s, &n);
> + strncpy((char *) &dfu->name, st, n);
what's with the pointless cast ? just do:
strncpy(dfu->name, st, n);
also, "n" here is wrong. it should be sizeof(dfu->name), not (presumably) the
length of st. considering this is the 2nd time i noticed this bug in the dfu
patchset, you might want to do a grep on your patches to see if your other
string related usage is wrong.
> +void dfu_free_entities(void)
> +{
> + struct dfu_entity *dfu = NULL, *p = NULL;
no point in assigning to NULL here
> +static char *dfu_get_dev_type(enum dfu_device_type t)
static const char *...
> +{
> + static char *dev_t[] = {NULL, "MMC", "ONENAND", "NAND" };
static const char * const dev_t[] = {...}
> +static char *dfu_get_layout(enum dfu_device_type l)
static const char *...
> +{
> + static char *dfu_layout[] = {NULL, "RAW_ADDR", "FAT", "EXT" };
static const char * const dfu_layout[] = {...}
> +void dfu_show_entities(void)
> +{
> + struct dfu_entity *dfu = NULL;
no point in assigning to NULL
> +struct dfu_entity *dfu_get_entity(int alt)
> +{
> + struct dfu_entity *dfu = NULL;
no point in assigning to NULL
-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/97ce9d54/attachment.pgp>
More information about the U-Boot
mailing list