[U-Boot] [PATCH 3/7] dfu: DFU backend implementation

Lukasz Majewski
2012-07-23T16:11:05Z

Dear Mike Frysinger,

> 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() ?
Ok, will be done
>
> > +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);
Yes, you are right.

>
> 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.

I will double-check the string operations.

>
> > +void dfu_free_entities(void)
> > +{
> > + struct dfu_entity *dfu = NULL, *p = NULL;
>
> no point in assigning to NULL here

Will remove.
>
> > +static char *dfu_get_dev_type(enum dfu_device_type t)
>
> static const char *...
Will correct.
>
> > +{
> > + static char *dev_t[] = {NULL, "MMC", "ONENAND", "NAND" };
>
> static const char * const dev_t[] = {...}
Ok
>
> > +static char *dfu_get_layout(enum dfu_device_type l)
>
> static const char *...
>
Ok
> > +{
> > + static char *dfu_layout[] = {NULL, "RAW_ADDR", "FAT",
> > "EXT" };
>
> static const char * const dfu_layout[] = {...}
>
OK
> > +void dfu_show_entities(void)
> > +{
> > + struct dfu_entity *dfu = NULL;
>
> no point in assigning to NULL
OK
>
> > +struct dfu_entity *dfu_get_entity(int alt)
> > +{
> > + struct dfu_entity *dfu = NULL;
>
> no point in assigning to NULL
OK
> -mike

--
Best regards,

Lukasz Majewski

Samsung Poland R&D Center | Linux Platform Group