From: Wolfgang Denk Date: Tue, 10 May 2011 15:38:21 +0200 Subject: [U-Boot] [PATCH] Fix incorrect use of getenv() before relocation In-Reply-To: References: <1304541148-11038-1-git-send-email-wd@denx.de> Message-ID: <20110510133821.0C816D6BE22@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Detlev Zundel, In message 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.