summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-05-04 10:32:28 +0000
committerWolfgang Denk <wd@denx.de>2011-05-12 19:48:42 +0200
commitf0c0b3a9e6f28a34d6da5edabba1e874fdf8e675 (patch)
treeb48adf0159f02551ab3318f469b085cfa0b26bb8
parenta02a884b95c47e114a54f2751d03f139f312af2f (diff)
downloadu-boot-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.tar.gz
u-boot-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.tar.xz
u-boot-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.zip
Fix incorrect use of getenv() before relocation
A large number of boards incorrectly used getenv() in their board init code running before relocation. In some cases this caused U-Boot to hang when certain environment variables grew too long. Fix the code to use getenv_r(). Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: The LEOX team <team@leox.org> Cc: Michael Schwingen <michael@schwingen.org> Cc: Georg Schardt <schardt@team-ctech.de> Cc: Werner Pfister <Pfister_Werner@intercontrol.de> Cc: Dirk Eibach <eibach@gdsys.de> Cc: Peter De Schrijver <p2@mind.be> Cc: John Zhan <zhanz@sinovee.com> Cc: Rishi Bhattacharya <rishi@ti.com> Cc: Peter Tyser <ptyser@xes-inc.com>
-rw-r--r--board/LEOX/elpt860/elpt860.c5
-rw-r--r--board/RRvision/RRvision.c10
-rw-r--r--board/actux1/actux1.c9
-rw-r--r--board/actux2/actux2.c9
-rw-r--r--board/actux3/actux3.c7
-rw-r--r--board/amcc/acadia/acadia.c7
-rw-r--r--board/amcc/bamboo/bamboo.c7
-rw-r--r--board/amcc/bluestone/bluestone.c7
-rw-r--r--board/amcc/bubinga/bubinga.c7
-rw-r--r--board/amcc/canyonlands/canyonlands.c7
-rw-r--r--board/amcc/ebony/ebony.c7
-rw-r--r--board/amcc/katmai/katmai.c7
-rw-r--r--board/amcc/kilauea/kilauea.c7
-rw-r--r--board/amcc/luan/luan.c7
-rw-r--r--board/amcc/makalu/makalu.c7
-rw-r--r--board/amcc/ocotea/ocotea.c9
-rw-r--r--board/amcc/redwood/redwood.c7
-rw-r--r--board/amcc/sequoia/sequoia.c7
-rw-r--r--board/amcc/taihu/taihu.c7
-rw-r--r--board/amcc/taishan/taishan.c9
-rw-r--r--board/amcc/walnut/walnut.c7
-rw-r--r--board/amcc/yosemite/yosemite.c7
-rw-r--r--board/amcc/yucca/yucca.c7
-rw-r--r--board/amirix/ap1000/ap1000.c24
-rw-r--r--board/avnet/fx12mm/fx12mm.c17
-rw-r--r--board/c2mon/c2mon.c10
-rw-r--r--board/digsy_mtc/digsy_mtc.c7
-rw-r--r--board/etx094/etx094.c16
-rw-r--r--board/gdsys/405ep/dlvision-10g.c7
-rw-r--r--board/gdsys/405ep/io.c7
-rw-r--r--board/gdsys/405ep/iocon.c7
-rw-r--r--board/gdsys/dlvision/dlvision.c7
-rw-r--r--board/gdsys/gdppc440etx/gdppc440etx.c7
-rw-r--r--board/gdsys/intip/intip.c7
-rw-r--r--board/gdsys/neo/neo.c7
-rw-r--r--board/gw8260/gw8260.c8
-rw-r--r--board/hermes/hermes.c16
-rw-r--r--board/ixdp425/ixdp425.c7
-rw-r--r--board/lwmon5/lwmon5.c7
-rw-r--r--board/micronas/vct/vct.c7
-rw-r--r--board/ml2/ml2.c18
-rw-r--r--board/mosaixtech/icon/icon.c7
-rw-r--r--board/pcs440ep/pcs440ep.c7
-rw-r--r--board/prodrive/alpr/alpr.c9
-rw-r--r--board/prodrive/p3mx/p3mx.c7
-rw-r--r--board/prodrive/p3p440/p3p440.c7
-rw-r--r--board/prodrive/pdnb3/pdnb3.c7
-rw-r--r--board/quad100hd/quad100hd.c7
-rw-r--r--board/quantum/quantum.c10
-rw-r--r--board/rbc823/rbc823.c9
-rw-r--r--board/socrates/socrates.c12
-rw-r--r--board/svm_sc8xx/svm_sc8xx.c32
-rw-r--r--board/t3corp/t3corp.c7
-rw-r--r--board/ti/omap5912osk/omap5912osk.c7
-rw-r--r--board/tqc/tqm8260/tqm8260.c8
-rw-r--r--board/tqc/tqm8272/tqm8272.c8
-rw-r--r--board/tqc/tqm85xx/tqm85xx.c19
-rw-r--r--board/tqc/tqm8xx/tqm8xx.c18
-rw-r--r--board/xes/common/board.c17
-rw-r--r--board/xes/xpedite1000/xpedite1000.c21
-rw-r--r--board/zeus/zeus.c7
61 files changed, 323 insertions, 259 deletions
diff --git a/board/LEOX/elpt860/elpt860.c b/board/LEOX/elpt860/elpt860.c
index 905df92b1d..03868cdd73 100644
--- a/board/LEOX/elpt860/elpt860.c
+++ b/board/LEOX/elpt860/elpt860.c
@@ -169,9 +169,10 @@ int board_early_init_f (void)
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
- if (!s || strncmp (s, "ELPT860", 7))
+ if ((i < 0) || strncmp(buf, "ELPT860", 7))
printf ("### No HW ID - assuming ELPT860\n");
return (0); /* success */
diff --git a/board/RRvision/RRvision.c b/board/RRvision/RRvision.c
index 9d016c59d3..0182d8a335 100644
--- a/board/RRvision/RRvision.c
+++ b/board/RRvision/RRvision.c
@@ -93,14 +93,16 @@ const uint sdram_table[] =
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: RRvision ");
- for (; s && *s; ++s) {
- if (*s == ' ')
+ for (i=0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
- putc (*s);
+ putc (buf[i]);
}
putc ('\n');
diff --git a/board/actux1/actux1.c b/board/actux1/actux1.c
index e73aff8ced..85e3f9e6c4 100644
--- a/board/actux1/actux1.c
+++ b/board/actux1/actux1.c
@@ -89,14 +89,15 @@ int board_init (void)
*/
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: AcTux-1 rev.");
putc (ACTUX1_BOARDREL + 'A' - 1);
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
putc ('\n');
diff --git a/board/actux2/actux2.c b/board/actux2/actux2.c
index d6aaad6201..0d67f80b97 100644
--- a/board/actux2/actux2.c
+++ b/board/actux2/actux2.c
@@ -96,14 +96,15 @@ int board_init (void)
*/
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: AcTux-2 rev.");
putc (ACTUX2_BOARDREL + 'A' - 1);
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
putc ('\n');
diff --git a/board/actux3/actux3.c b/board/actux3/actux3.c
index 63bf365b8a..bace2547e1 100644
--- a/board/actux3/actux3.c
+++ b/board/actux3/actux3.c
@@ -111,14 +111,15 @@ int board_init (void)
*/
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: AcTux-3 rev.");
putc (ACTUX3_BOARDREL + 'A' - 1);
- if (s != NULL) {
+ if (i > 0) {
puts (", serial# ");
- puts (s);
+ puts (buf);
}
putc ('\n');
diff --git a/board/amcc/acadia/acadia.c b/board/amcc/acadia/acadia.c
index 482561122a..68a99bd1ee 100644
--- a/board/amcc/acadia/acadia.c
+++ b/board/amcc/acadia/acadia.c
@@ -102,15 +102,16 @@ int misc_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u8 rev;
rev = in8(CONFIG_SYS_CPLD_BASE + 0);
printf("Board: Acadia - AMCC PPC405EZ Evaluation Board, Rev. %X", rev);
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/bamboo/bamboo.c b/board/amcc/bamboo/bamboo.c
index d4205e034b..79788a80fc 100644
--- a/board/amcc/bamboo/bamboo.c
+++ b/board/amcc/bamboo/bamboo.c
@@ -440,12 +440,13 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Bamboo - AMCC PPC440EP Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/bluestone/bluestone.c b/board/amcc/bluestone/bluestone.c
index fe8929c389..584f5effc6 100644
--- a/board/amcc/bluestone/bluestone.c
+++ b/board/amcc/bluestone/bluestone.c
@@ -78,13 +78,14 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: Bluestone Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/bubinga/bubinga.c b/board/amcc/bubinga/bubinga.c
index 49eadb9212..1ed0aeeaf9 100644
--- a/board/amcc/bubinga/bubinga.c
+++ b/board/amcc/bubinga/bubinga.c
@@ -53,13 +53,14 @@ int board_early_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: Bubinga - AMCC PPC405EP Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/canyonlands/canyonlands.c b/board/amcc/canyonlands/canyonlands.c
index 80e2739fe0..2f0d94172b 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -293,7 +293,8 @@ int checkboard(void)
{
struct board_bcsr *bcsr_data =
(struct board_bcsr *)CONFIG_SYS_BCSR_BASE;
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
if (pvr_460ex()) {
printf("Board: Canyonlands - AMCC PPC460EX Evaluation Board");
@@ -319,9 +320,9 @@ int checkboard(void)
printf(", Rev. %X", in_8(&bcsr_data->cpld_rev));
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/ebony/ebony.c b/board/amcc/ebony/ebony.c
index 923dbca718..ad9439497c 100644
--- a/board/amcc/ebony/ebony.c
+++ b/board/amcc/ebony/ebony.c
@@ -92,12 +92,13 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Ebony - AMCC PPC440GP Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c
index 7301cd5953..34380658e5 100644
--- a/board/amcc/katmai/katmai.c
+++ b/board/amcc/katmai/katmai.c
@@ -236,12 +236,13 @@ int board_early_init_f (void)
int checkboard (void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Katmai - AMCC 440SPe Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/kilauea/kilauea.c b/board/amcc/kilauea/kilauea.c
index bd6550cd05..1648734ab6 100644
--- a/board/amcc/kilauea/kilauea.c
+++ b/board/amcc/kilauea/kilauea.c
@@ -307,16 +307,17 @@ int board_pcie_last(void)
int checkboard (void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
if (is_405exr())
printf("Board: Haleakala - AMCC PPC405EXr Evaluation Board");
else
printf("Board: Kilauea - AMCC PPC405EX Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
printf(" (CPLD rev. %ld)\n", gd->board_type);
diff --git a/board/amcc/luan/luan.c b/board/amcc/luan/luan.c
index b2595a8ec1..d4b620e857 100644
--- a/board/amcc/luan/luan.c
+++ b/board/amcc/luan/luan.c
@@ -105,13 +105,14 @@ int misc_init_r(void)
************************************************************************/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Luan - AMCC PPC440SP Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/makalu/makalu.c b/board/amcc/makalu/makalu.c
index 483df66272..34a094fc76 100644
--- a/board/amcc/makalu/makalu.c
+++ b/board/amcc/makalu/makalu.c
@@ -224,13 +224,14 @@ int misc_init_r(void)
int checkboard (void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Makalu - AMCC PPC405EX Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/ocotea/ocotea.c b/board/amcc/ocotea/ocotea.c
index bbb5331ef2..d2091e5bf4 100644
--- a/board/amcc/ocotea/ocotea.c
+++ b/board/amcc/ocotea/ocotea.c
@@ -200,12 +200,13 @@ int board_early_init_f (void)
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf ("Board: Ocotea - AMCC PPC440GX Evaluation Board");
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
putc ('\n');
diff --git a/board/amcc/redwood/redwood.c b/board/amcc/redwood/redwood.c
index bb7565e2e4..8ca14954c7 100644
--- a/board/amcc/redwood/redwood.c
+++ b/board/amcc/redwood/redwood.c
@@ -200,12 +200,13 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Redwood - AMCC 460SX Reference Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
index b518aa7d72..45e87f7631 100644
--- a/board/amcc/sequoia/sequoia.c
+++ b/board/amcc/sequoia/sequoia.c
@@ -331,7 +331,8 @@ int misc_init_r(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u8 rev;
u32 clock = get_async_pci_freq();
@@ -344,9 +345,9 @@ int checkboard(void)
rev = in_8((void *)(CONFIG_SYS_BCSR_BASE + 0));
printf(", Rev. %X, PCI-Async=%d MHz", rev, clock / 1000000);
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/taihu/taihu.c b/board/amcc/taihu/taihu.c
index 87c9403e4a..8c6b0977aa 100644
--- a/board/amcc/taihu/taihu.c
+++ b/board/amcc/taihu/taihu.c
@@ -65,13 +65,14 @@ int board_early_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: Taihu - AMCC PPC405EP Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/taishan/taishan.c b/board/amcc/taishan/taishan.c
index 2957a77486..fcaf7fde26 100644
--- a/board/amcc/taishan/taishan.c
+++ b/board/amcc/taishan/taishan.c
@@ -193,12 +193,13 @@ int misc_init_r(void)
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf ("Board: Taishan - AMCC PPC440GX Evaluation Board");
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
putc ('\n');
diff --git a/board/amcc/walnut/walnut.c b/board/amcc/walnut/walnut.c
index 4f299324cd..d3287cea19 100644
--- a/board/amcc/walnut/walnut.c
+++ b/board/amcc/walnut/walnut.c
@@ -67,7 +67,8 @@ int board_early_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
uint pvr = get_pvr();
if (pvr == PVR_405GPR_RB) {
@@ -76,9 +77,9 @@ int checkboard(void)
puts("Board: Walnut - AMCC PPC405GP Evaluation Board");
}
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/yosemite/yosemite.c b/board/amcc/yosemite/yosemite.c
index aaeab6f5fd..0c95c3634b 100644
--- a/board/amcc/yosemite/yosemite.c
+++ b/board/amcc/yosemite/yosemite.c
@@ -188,7 +188,8 @@ int misc_init_r (void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u8 rev;
u32 clock = get_async_pci_freq();
@@ -201,9 +202,9 @@ int checkboard(void)
rev = in_8((void *)(CONFIG_SYS_BCSR_BASE + 0));
printf(", Rev. %X, PCI-Async=%d MHz", rev, clock / 1000000);
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c
index b128e46c27..1fab794bd3 100644
--- a/board/amcc/yucca/yucca.c
+++ b/board/amcc/yucca/yucca.c
@@ -542,12 +542,13 @@ int board_early_init_f (void)
int checkboard (void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: Yucca - AMCC 440SPe Evaluation Board");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/amirix/ap1000/ap1000.c b/board/amirix/ap1000/ap1000.c
index c8dd99eb4c..64de04ca29 100644
--- a/board/amirix/ap1000/ap1000.c
+++ b/board/amirix/ap1000/ap1000.c
@@ -37,8 +37,8 @@ int board_pre_init (void)
/** serial number and platform display at startup */
int checkboard (void)
{
- char *s = getenv ("serial#");
- char *e;
+ char buf[64];
+ int l = getenv_f("serial#", buf, sizeof(buf));
/* After a loadace command, the SystemAce control register is left in a wonky state. */
/* this code did not work in board_pre_init */
@@ -115,17 +115,19 @@ int checkboard (void)
puts ("Serial#: ");
- if (!s) {
+ if (l < 0) {
printf ("### No HW ID - assuming AMIRIX");
} else {
- for (e = s; *e; ++e) {
- if (*e == ' ')
+ int i;
+
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ') {
+ buf[i] = '\0';
break;
+ }
}
- for (; s < e; ++s) {
- putc (*s);
- }
+ puts(buf);
}
putc ('\n');
@@ -136,9 +138,11 @@ int checkboard (void)
phys_size_t initdram (int board_type)
{
- char *s = getenv ("dramsize");
+ char buf[64];
+ int i = getenv_f("dramsize", buf, sizeof(buf));
- if (s != NULL) {
+ if (i > 0) {
+ char *s = buf;
if ((s[0] == '0') && ((s[1] == 'x') || (s[1] == 'X'))) {
s += 2;
}
diff --git a/board/avnet/fx12mm/fx12mm.c b/board/avnet/fx12mm/fx12mm.c
index e671a7bed1..c975efa395 100644
--- a/board/avnet/fx12mm/fx12mm.c
+++ b/board/avnet/fx12mm/fx12mm.c
@@ -32,20 +32,19 @@
int checkboard(void)
{
- char tmp[64];
- char *s, *e;
- int i = getenv_f("serial", tmp, sizeof(tmp));
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
- if (i < 0) {
+ if (l < 0) {
printf("Avnet Virtex4 FX12 with no serial #");
} else {
- for (e = tmp; *e; ++e) {
- if (*e == ' ')
+ printf("Avnet Virtex4 FX12 Minimodul # ");
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
+ putc(buf[i]);
}
- printf("Avnet Virtex4 FX12 Minimodul # ");
- for (s = tmp; s < e; ++s)
- putc(*s);
}
putc('\n');
return 0;
diff --git a/board/c2mon/c2mon.c b/board/c2mon/c2mon.c
index 717a64bb80..348dfa0af3 100644
--- a/board/c2mon/c2mon.c
+++ b/board/c2mon/c2mon.c
@@ -91,14 +91,16 @@ const uint sdram_table[] =
int checkboard (void)
{
- unsigned char *s = (unsigned char *)getenv ("serial#");
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: TTTech C2MON ");
- for (; s && *s; ++s) {
- if (*s == ' ')
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
- putc (*s);
+ putc (buf[i]);
}
putc ('\n');
diff --git a/board/digsy_mtc/digsy_mtc.c b/board/digsy_mtc/digsy_mtc.c
index 9f13a3d107..588facefef 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) {
+ if (i > 0) {
puts(", ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/etx094/etx094.c b/board/etx094/etx094.c
index d6f638af65..abefe4a482 100644
--- a/board/etx094/etx094.c
+++ b/board/etx094/etx094.c
@@ -92,8 +92,9 @@ const uint sdram_table[] = {
int checkboard (void)
{
- char *s = getenv ("serial#");
- char *e;
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: ");
@@ -103,19 +104,16 @@ int checkboard (void)
gd->board_type = 1; /* 1 = 1SDRAM-Device */
#endif
- if (!s || strncmp (s, "ETX_", 4)) {
+ if (l < 0 || strncmp(buf, "ETX_", 4)) {
puts ("### No HW ID - assuming ETX_094\n");
read_hw_vers ();
return (0);
}
- for (e = s; *e; ++e) {
- if (*e == ' ')
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
- }
-
- for (; s < e; ++s) {
- putc (*s);
+ putc(buf[i]);
}
putc ('\n');
diff --git a/board/gdsys/405ep/dlvision-10g.c b/board/gdsys/405ep/dlvision-10g.c
index 038854161f..ecba66ec71 100644
--- a/board/gdsys/405ep/dlvision-10g.c
+++ b/board/gdsys/405ep/dlvision-10g.c
@@ -225,15 +225,16 @@ static void print_fpga_info(unsigned dev)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: ");
printf("DLVision 10G");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
puts("\n");
diff --git a/board/gdsys/405ep/io.c b/board/gdsys/405ep/io.c
index 0974019ef7..db1ea7f0c5 100644
--- a/board/gdsys/405ep/io.c
+++ b/board/gdsys/405ep/io.c
@@ -87,8 +87,9 @@ err_out:
*/
int checkboard(void)
{
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0);
- char *s = getenv("serial#");
u16 versions = in_le16(&fpga->versions);
u16 fpga_version = in_le16(&fpga->fpga_version);
u16 fpga_features = in_le16(&fpga->fpga_features);
@@ -106,9 +107,9 @@ int checkboard(void)
printf("CATCenter Io");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
puts("\n ");
diff --git a/board/gdsys/405ep/iocon.c b/board/gdsys/405ep/iocon.c
index 20770e4eff..ce53340894 100644
--- a/board/gdsys/405ep/iocon.c
+++ b/board/gdsys/405ep/iocon.c
@@ -69,8 +69,9 @@ enum {
*/
int checkboard(void)
{
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0);
- char *s = getenv("serial#");
u16 versions = in_le16(&fpga->versions);
u16 fpga_version = in_le16(&fpga->fpga_version);
u16 fpga_features = in_le16(&fpga->fpga_features);
@@ -98,9 +99,9 @@ int checkboard(void)
printf("IoCon");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
puts("\n ");
diff --git a/board/gdsys/dlvision/dlvision.c b/board/gdsys/dlvision/dlvision.c
index 3499bdc685..5c70326d50 100644
--- a/board/gdsys/dlvision/dlvision.c
+++ b/board/gdsys/dlvision/dlvision.c
@@ -75,7 +75,8 @@ int misc_init_r(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u8 channel2_msr = in_8((void *)CONFIG_UART_BASE + 0x26);
u8 channel3_msr = in_8((void *)CONFIG_UART_BASE + 0x36);
u8 channel7_msr = in_8((void *)CONFIG_UART_BASE + 0x76);
@@ -108,9 +109,9 @@ int checkboard(void)
break;
}
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
puts("\n ");
diff --git a/board/gdsys/gdppc440etx/gdppc440etx.c b/board/gdsys/gdppc440etx/gdppc440etx.c
index 328eb95aa3..c58411ee88 100644
--- a/board/gdsys/gdppc440etx/gdppc440etx.c
+++ b/board/gdsys/gdppc440etx/gdppc440etx.c
@@ -145,13 +145,14 @@ int misc_init_r(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: GDPPC440ETX - G&D PPC440EP/GR ETX-module");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/gdsys/intip/intip.c b/board/gdsys/intip/intip.c
index aa85ea416a..0132b2595d 100644
--- a/board/gdsys/intip/intip.c
+++ b/board/gdsys/intip/intip.c
@@ -124,7 +124,8 @@ int get_cpu_num(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
#ifdef CONFIG_DEVCONCENTER
printf("Board: DevCon-Center");
@@ -132,9 +133,9 @@ int checkboard(void)
printf("Board: Intip");
#endif
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/gdsys/neo/neo.c b/board/gdsys/neo/neo.c
index a56c2cc987..d21d599fa7 100644
--- a/board/gdsys/neo/neo.c
+++ b/board/gdsys/neo/neo.c
@@ -53,7 +53,8 @@ int board_early_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u16 val = in_le16((void *)CONFIG_FPGA_BASE + 2);
u8 unit_type;
u8 hardware_cpu_ports;
@@ -62,9 +63,9 @@ int checkboard(void)
printf("Board: CATCenter Neo");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
puts("\n ");
diff --git a/board/gw8260/gw8260.c b/board/gw8260/gw8260.c
index 28f5ca99e8..77a1e1d3ac 100644
--- a/board/gw8260/gw8260.c
+++ b/board/gw8260/gw8260.c
@@ -214,13 +214,13 @@ const iop_conf_t iop_conf_tab[4][32] = {
/*********************************************************************/
int checkboard (void)
{
- char *str;
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: Advent Networks gw8260\n");
- str = getenv ("serial#");
- if (str != NULL) {
- printf ("SN: %s\n", str);
+ if (i > 0) {
+ printf("SN: %s\n", buf);
}
return 0;
}
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index 9a3e5f6690..acf364e2b9 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -107,21 +107,19 @@ const uint sdram_table[] = {
int checkboard (void)
{
- char *s = getenv ("serial#");
- char *e;
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: ");
- if (!s || strncmp (s, "HERMES", 6)) {
+ if (l < 0 || strncmp(buf, "HERMES", 6)) {
puts ("### No HW ID - assuming HERMES-PRO");
} else {
- for (e = s; *e; ++e) {
- if (*e == ' ')
+ for (i = 0; i < l; i++) {
+ if (buf[i] == ' ')
break;
- }
-
- for (; s < e; ++s) {
- putc (*s);
+ putc (buf[i]);
}
}
diff --git a/board/ixdp425/ixdp425.c b/board/ixdp425/ixdp425.c
index 43ac8f6a42..a29d584389 100644
--- a/board/ixdp425/ixdp425.c
+++ b/board/ixdp425/ixdp425.c
@@ -83,7 +83,8 @@ int board_init (void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
#ifdef CONFIG_IXDPG425
puts("Board: IXDPG425 - Intel Network Gateway Reference Platform");
@@ -91,9 +92,9 @@ int checkboard(void)
puts("Board: IXDP425 - Intel Development Platform");
#endif
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c
index dd275bf777..ecd9536145 100644
--- a/board/lwmon5/lwmon5.c
+++ b/board/lwmon5/lwmon5.c
@@ -333,13 +333,14 @@ int misc_init_r(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: lwmon5");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c
index 7fc3507b0e..a8eef370e0 100644
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
@@ -80,8 +80,9 @@ phys_size_t initdram(int board_type)
int checkboard(void)
{
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
u32 config0 = read_c0_prid();
- char *s = getenv("serial#");
if ((config0 & 0xff0000) == PRID_COMP_LEGACY
&& (config0 & 0xff00) == PRID_IMP_LX4280) {
@@ -108,9 +109,9 @@ int checkboard(void)
}
printf("Board: Micronas VCT " BOARD_NAME BOARD_NAME_ADD);
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/ml2/ml2.c b/board/ml2/ml2.c
index 981e1decda..319dca09db 100644
--- a/board/ml2/ml2.c
+++ b/board/ml2/ml2.c
@@ -30,23 +30,19 @@ int board_early_init_f (void)
int checkboard (void)
{
- char *s = getenv ("serial#");
- char *e;
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
- if (!s || strncmp (s, "ML2", 9)) {
+ if (l < 0 || strncmp(buf, "ML2", 9)) {
printf ("### No HW ID - assuming ML2");
} else {
- for (e = s; *e; ++e) {
- if (*e == ' ')
+ for (i = 0; i < l; i++) {
+ if (buf[i] == ' ')
break;
- }
-
- for (; s < e; ++s) {
- putc (*s);
+ putc(buf[i]);
}
}
-
-
putc ('\n');
return (0);
diff --git a/board/mosaixtech/icon/icon.c b/board/mosaixtech/icon/icon.c
index e09dbc3df0..e464e4395c 100644
--- a/board/mosaixtech/icon/icon.c
+++ b/board/mosaixtech/icon/icon.c
@@ -275,12 +275,13 @@ int board_early_init_r(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: ICON");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 70d8fe2c37..5a3ec58445 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -509,12 +509,13 @@ int misc_init_r (void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: PCS440EP");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/prodrive/alpr/alpr.c b/board/prodrive/alpr/alpr.c
index 178498235e..a64f6b09c9 100644
--- a/board/prodrive/alpr/alpr.c
+++ b/board/prodrive/alpr/alpr.c
@@ -133,12 +133,13 @@ static int board_rev(void)
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf ("Board: ALPR");
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
printf(" (Rev. %d)\n", board_rev());
diff --git a/board/prodrive/p3mx/p3mx.c b/board/prodrive/p3mx/p3mx.c
index 05eca52e0e..09e4f823f0 100644
--- a/board/prodrive/p3mx/p3mx.c
+++ b/board/prodrive/p3mx/p3mx.c
@@ -335,13 +335,14 @@ void after_reloc (ulong dest_addr, gd_t * gd)
int checkboard (void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: %s", CONFIG_SYS_BOARD_NAME);
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/prodrive/p3p440/p3p440.c b/board/prodrive/p3p440/p3p440.c
index 020f66dd8e..1bb9686a3b 100644
--- a/board/prodrive/p3p440/p3p440.c
+++ b/board/prodrive/p3p440/p3p440.c
@@ -122,12 +122,13 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: P3P440");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
if (is_monarch()) {
diff --git a/board/prodrive/pdnb3/pdnb3.c b/board/prodrive/pdnb3/pdnb3.c
index 928dd2222d..3aaebf2439 100644
--- a/board/prodrive/pdnb3/pdnb3.c
+++ b/board/prodrive/pdnb3/pdnb3.c
@@ -101,13 +101,14 @@ int board_init(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: PDNB3");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/quad100hd/quad100hd.c b/board/quad100hd/quad100hd.c
index 2f72d2b1be..6044e85585 100644
--- a/board/quad100hd/quad100hd.c
+++ b/board/quad100hd/quad100hd.c
@@ -58,16 +58,17 @@ int board_early_init_f(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
#ifdef DISPLAY_BOARD_INFO
sys_info_t sysinfo;
#endif
puts("Board: Quad100hd");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/quantum/quantum.c b/board/quantum/quantum.c
index d94b5d72a4..61c6a68b87 100644
--- a/board/quantum/quantum.c
+++ b/board/quantum/quantum.c
@@ -87,14 +87,16 @@ const uint sdram_table[] = {
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board QUANTUM, Serial No: ");
- for (; s && *s; ++s) {
- if (*s == ' ')
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
- putc (*s);
+ putc (buf[i]);
}
putc ('\n');
return (0); /* success */
diff --git a/board/rbc823/rbc823.c b/board/rbc823/rbc823.c
index e10d9f9ff0..ddfba14919 100644
--- a/board/rbc823/rbc823.c
+++ b/board/rbc823/rbc823.c
@@ -127,15 +127,16 @@ const uint static_table[] =
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
- if (!s || strncmp (s, "TQM8", 4)) {
+ if (i < 0 || strncmp(buf, "TQM8", 4)) {
printf ("### No HW ID - assuming RBC823\n");
return (0);
}
- puts (s);
- putc ('\n');
+ puts(buf);
+ putc('\n');
return (0);
}
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 72e7401f14..65fb70ad73 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -52,15 +52,17 @@ ulong flash_get_size (ulong base, int banknum);
int checkboard (void)
{
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-
- char *src;
+ char buf[64];
int f;
- char *s = getenv("serial#");
+ int i = getenv_f("serial#", buf, sizeof(buf));
+#ifdef CONFIG_PCI
+ char *src;
+#endif
puts("Board: Socrates");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/svm_sc8xx/svm_sc8xx.c b/board/svm_sc8xx/svm_sc8xx.c
index 4390e49dd1..f34b83515e 100644
--- a/board/svm_sc8xx/svm_sc8xx.c
+++ b/board/svm_sc8xx/svm_sc8xx.c
@@ -75,27 +75,29 @@ const uint sdram_table[] =
* Return 1 for "SC8xx" type, 0 else.
*/
-int checkboard (void)
+int checkboard(void)
{
- char *s = getenv("serial#");
- int board_type;
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
+ int board_type;
- if (!s || strncmp(s, "SVM8", 4)) {
- printf ("### No HW ID - assuming SVM SC8xx\n");
- return (0);
- }
+ if (l < 0 || strncmp(buf, "SVM8", 4)) {
+ printf("### No HW ID - assuming SVM SC8xx\n");
+ return (0);
+ }
- board_type = 1;
+ board_type = 1;
- for (; *s; ++s) {
- if (*s == ' ')
- break;
- putc (*s);
- }
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
+ break;
+ putc(buf[i]);
+ }
- putc ('\n');
+ putc('\n');
- return (0);
+ return (0);
}
/* ------------------------------------------------------------------------- */
diff --git a/board/t3corp/t3corp.c b/board/t3corp/t3corp.c
index f2853e42e5..57f09fa367 100644
--- a/board/t3corp/t3corp.c
+++ b/board/t3corp/t3corp.c
@@ -89,13 +89,14 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf("Board: T3CORP");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/ti/omap5912osk/omap5912osk.c b/board/ti/omap5912osk/omap5912osk.c
index cbf451baaf..6f0e763f01 100644
--- a/board/ti/omap5912osk/omap5912osk.c
+++ b/board/ti/omap5912osk/omap5912osk.c
@@ -295,13 +295,14 @@ void peripheral_power_enable (void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: OSK5912");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');
diff --git a/board/tqc/tqm8260/tqm8260.c b/board/tqc/tqm8260/tqm8260.c
index 95073b8446..65a3174ec6 100644
--- a/board/tqc/tqm8260/tqm8260.c
+++ b/board/tqc/tqm8260/tqm8260.c
@@ -195,17 +195,17 @@ const iop_conf_t iop_conf_tab[4][32] = {
*/
int checkboard (void)
{
- char str[64];
- int i = getenv_f("serial#", str, sizeof (str));
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: ");
- if (!i || strncmp (str, "TQM82", 5)) {
+ if (i < 0 || strncmp(buf, "TQM82", 5)) {
puts ("### No HW ID - assuming TQM8260\n");
return (0);
}
- puts (str);
+ puts (buf);
putc ('\n');
return 0;
diff --git a/board/tqc/tqm8272/tqm8272.c b/board/tqc/tqm8272/tqm8272.c
index 96ec078fd9..9efb54125e 100644
--- a/board/tqc/tqm8272/tqm8272.c
+++ b/board/tqc/tqm8272/tqm8272.c
@@ -514,12 +514,16 @@ static inline int scanChar (char *p, int len, unsigned long *number)
static int dump_hwib(void)
{
HWIB_INFO *hw = &hwinf;
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
- char *s = getenv("serial#");
+
+ if (i < 0)
+ buf[0] = '\0';
if (hw->OK) {
printf ("HWIB on %x\n", HWIB_INFO_START_ADDR);
- printf ("serial : %s\n", s);
+ printf ("serial : %s\n", buf);
printf ("ethaddr: %s\n", hw->ethaddr);
printf ("FLASH : %x nr:%d\n", hw->flash, hw->flash_nr);
printf ("RAM : %x cs:%d\n", hw->ram, hw->ram_cs);
diff --git a/board/tqc/tqm85xx/tqm85xx.c b/board/tqc/tqm85xx/tqm85xx.c
index 99b13311ce..8fb73abde7 100644
--- a/board/tqc/tqm85xx/tqm85xx.c
+++ b/board/tqc/tqm85xx/tqm85xx.c
@@ -227,17 +227,19 @@ static const int casl_table[] = { 20, 25, 30 };
int cas_latency (void)
{
- char *s = getenv ("serial#");
+ char buf[128];
int casl;
int val;
int i;
casl = CONFIG_DDR_DEFAULT_CL;
- if (s != NULL) {
- if (strncmp(s + strlen (s) - strlen (CASL_STRING1),
+ i = getenv_f("serial#", buf, sizeof(buf));
+
+ if (i >0) {
+ if (strncmp(buf + strlen (buf) - strlen (CASL_STRING1),
CASL_STRING2, strlen (CASL_STRING2)) == 0) {
- val = simple_strtoul (s + strlen (s) - 2, NULL, 10);
+ val = simple_strtoul (buf + strlen (buf) - 2, NULL, 10);
for (i = 0; i < N_CASL; ++i) {
if (val == casl_table[i]) {
@@ -252,12 +254,13 @@ int cas_latency (void)
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
printf ("Board: %s", CONFIG_BOARDNAME);
- if (s != NULL) {
- puts (", serial# ");
- puts (s);
+ if (i > 0) {
+ puts(", serial# ");
+ puts(buf);
}
putc ('\n');
diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c
index 6576e0288a..1fda53b9ae 100644
--- a/board/tqc/tqm8xx/tqm8xx.c
+++ b/board/tqc/tqm8xx/tqm8xx.c
@@ -106,31 +106,33 @@ const uint sdram_table[] =
int checkboard (void)
{
- char *s = getenv ("serial#");
+ char buf[64];
+ int i;
+ int l = getenv_f("serial#", buf, sizeof(buf));
puts ("Board: ");
- if (!s || strncmp (s, "TQM8", 4)) {
+ if (l < 0 || strncmp(buf, "TQM8", 4)) {
puts ("### No HW ID - assuming TQM8xxL\n");
return (0);
}
- if ((*(s + 6) == 'L')) { /* a TQM8xxL type */
+ if ((buf[6] == 'L')) { /* a TQM8xxL type */
gd->board_type = 'L';
}
- if ((*(s + 6) == 'M')) { /* a TQM8xxM type */
+ if ((buf[6] == 'M')) { /* a TQM8xxM type */
gd->board_type = 'M';
}
- if ((*(s + 6) == 'D')) { /* a TQM885D type */
+ if ((buf[6] == 'D')) { /* a TQM885D type */
gd->board_type = 'D';
}
- for (; *s; ++s) {
- if (*s == ' ')
+ for (i = 0; i < l; ++i) {
+ if (buf[i] == ' ')
break;
- putc (*s);
+ putc (buf[i]);
}
#ifdef CONFIG_VIRTLAB2
puts (" (Virtlab2)");
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
index 738f0a6486..4e60bb5055 100644
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
@@ -13,7 +13,9 @@
int checkboard(void)
{
char name[] = CONFIG_SYS_BOARD_NAME;
+ char buf[64];
char *s;
+ int i;
#ifdef CONFIG_SYS_FORM_CUSTOM
s = "Custom";
@@ -52,12 +54,15 @@ int checkboard(void)
/* Display board specific information */
puts(" ");
- if ((s = getenv("board_rev")))
- printf("Rev %s, ", s);
- if ((s = getenv("serial#")))
- printf("Serial# %s, ", s);
- if ((s = getenv("board_cfg")))
- printf("Cfg %s", s);
+ i = getenv_f("board_rev", buf, sizeof(buf));
+ if (i > 0)
+ printf("Rev %s, ", buf);
+ i = getenv_f("serial#", buf, sizeof(buf));
+ if (i > 0)
+ printf("Serial# %s, ", buf);
+ i = getenv_f("board_cfg", buf, sizeof(buf));
+ if (i > 0)
+ printf("Cfg %s", buf);
puts("\n");
return 0;
diff --git a/board/xes/xpedite1000/xpedite1000.c b/board/xes/xpedite1000/xpedite1000.c
index a3534d2d7a..4b0ee9281f 100644
--- a/board/xes/xpedite1000/xpedite1000.c
+++ b/board/xes/xpedite1000/xpedite1000.c
@@ -112,19 +112,20 @@ int board_early_init_f(void)
int checkboard(void)
{
- char *s;
+ char buf[64];
+ int i;
printf("Board: X-ES %s PMC SBC\n", CONFIG_SYS_BOARD_NAME);
printf(" ");
- s = getenv("board_rev");
- if (s)
- printf("Rev %s, ", s);
- s = getenv("serial#");
- if (s)
- printf("Serial# %s, ", s);
- s = getenv("board_cfg");
- if (s)
- printf("Cfg %s", s);
+ i = getenv_f("board_rev", buf, sizeof(buf));
+ if (i > 0)
+ printf("Rev %s, ", buf);
+ i = getenv_f("serial#", buf, sizeof(buf));
+ if (i > 0)
+ printf("Serial# %s, ", buf);
+ i = getenv_f("board_cfg", buf, sizeof(buf));
+ if (i > 0)
+ printf("Cfg %s", buf);
printf("\n");
return 0;
diff --git a/board/zeus/zeus.c b/board/zeus/zeus.c
index 7e33d3f383..18cb85faf3 100644
--- a/board/zeus/zeus.c
+++ b/board/zeus/zeus.c
@@ -161,7 +161,8 @@ int misc_init_r(void)
*/
int checkboard(void)
{
- char *s = getenv("serial#");
+ char buf[64];
+ int i = getenv_f("serial#", buf, sizeof(buf));
puts("Board: Zeus-");
@@ -172,9 +173,9 @@ int checkboard(void)
puts(" of BulletEndPoint");
- if (s != NULL) {
+ if (i > 0) {
puts(", serial# ");
- puts(s);
+ puts(buf);
}
putc('\n');