[U-Boot] [PATCH 22/30] km/common: implement setboardid as a command

Wolfgang Denk
2011-04-30T08:25:21Z

Dear Valentin Longchamp,

In message <30d7413306aba80ca4540c3353d884bdffe9a643.1302272395.git.valentin.longchamp@keymile.com> you wrote:
> From: Holger Brunck <holger.brunck@keymile.com>
>
> Read out board id and HW key from the IVM eeprom and set
> these values as an environment variable was now done inside the
> code as a command.

This begs to ask: and how has it been done so far? Should this patch
not remove some old code, then?

> +{
> + unsigned char buf[32];
> + char *p;
> +
> + p = get_local_var("IVM_BoardId");
> + sprintf((char *)buf, "%s", p);
> + setenv("boardid", (char *)buf);
> + p = get_local_var("IVM_HWKey");
> + sprintf((char *)buf, "%s", p);
> + setenv("hwkey", (char *)buf);

get_local_var() will return NULL in some cases. Error handling
missing.

> + return 0;

As is, the return 0 makes no sense, but I guess this will change when
you add error handling.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Empire didn't encourage its subjects to go far away, in case they
saw things that might disturb them. For the same reason it had built
a wall around the entire country, patrolled by the Heavenly Guard
whose main function was to tread heavily on the fingers of any inha-
bitants who felt they might like to step outside for five minutes for
a breath of fresh air. - Terry Pratchett, _Mort_