[U-Boot] [PATCH] Fix incorrect use of getenv() before relocation

Wolfgang Denk wd at denx.de
Tue May 10 15:38:21 CEST 2011


Dear Detlev Zundel,

In message <m24o52ltse.fsf at ohwell.denx.de> you wrote:
> 
...
> > index 9f13a3d..a0c4b10 100644
> > --- a/board/digsy_mtc/digsy_mtc.c
> > +++ b/board/digsy_mtc/digsy_mtc.c
> > @@ -191,15 +191,16 @@ phys_size_t initdram(int board_type)
> >  
> >  int checkboard(void)
> >  {
> > -	char *s = getenv("serial#");
> > +	char buf[64];
> > +	int i = getenv_f("serial#", buf, sizeof(buf));
> >  
> >  	puts ("Board: InterControl digsyMTC");
> >  #if defined(CONFIG_DIGSY_REV5)
> >  	puts (" rev5");
> >  #endif
> > -	if (s != NULL) {
> > -		puts(", ");
> > -		puts(s);
> > +	if (i > 0) {
> > +		puts(", serial# ");
> > +		puts(buf);
> >  	}
> >  	putc('\n');
> 
> This changes the output.  On the other hand, this feature was never used
> on this board, so I'm ok with removing this read altogether.

You are right, this should be:

+	if (i > 0) {
+		puts(", ");
+		puts(buf);

What do you mean by "removing this read" ?


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
CAUTION:  The Mass of This Product Contains the Energy Equivalent  of
85 Million Tons of TNT per Net Ounce of Weight.


More information about the U-Boot mailing list