From f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Wed, 4 May 2011 10:32:28 +0000 Subject: 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 Cc: Stefan Roese Cc: The LEOX team Cc: Michael Schwingen Cc: Georg Schardt Cc: Werner Pfister Cc: Dirk Eibach Cc: Peter De Schrijver Cc: John Zhan Cc: Rishi Bhattacharya Cc: Peter Tyser --- board/LEOX/elpt860/elpt860.c | 5 +++-- board/RRvision/RRvision.c | 10 ++++++---- board/actux1/actux1.c | 9 +++++---- board/actux2/actux2.c | 9 +++++---- board/actux3/actux3.c | 7 ++++--- board/amcc/acadia/acadia.c | 7 ++++--- board/amcc/bamboo/bamboo.c | 7 ++++--- board/amcc/bluestone/bluestone.c | 7 ++++--- board/amcc/bubinga/bubinga.c | 7 ++++--- board/amcc/canyonlands/canyonlands.c | 7 ++++--- board/amcc/ebony/ebony.c | 7 ++++--- board/amcc/katmai/katmai.c | 7 ++++--- board/amcc/kilauea/kilauea.c | 7 ++++--- board/amcc/luan/luan.c | 7 ++++--- board/amcc/makalu/makalu.c | 7 ++++--- board/amcc/ocotea/ocotea.c | 9 +++++---- board/amcc/redwood/redwood.c | 7 ++++--- board/amcc/sequoia/sequoia.c | 7 ++++--- board/amcc/taihu/taihu.c | 7 ++++--- board/amcc/taishan/taishan.c | 9 +++++---- board/amcc/walnut/walnut.c | 7 ++++--- board/amcc/yosemite/yosemite.c | 7 ++++--- board/amcc/yucca/yucca.c | 7 ++++--- board/amirix/ap1000/ap1000.c | 24 ++++++++++++++---------- board/avnet/fx12mm/fx12mm.c | 17 ++++++++--------- board/c2mon/c2mon.c | 10 ++++++---- board/digsy_mtc/digsy_mtc.c | 7 ++++--- board/etx094/etx094.c | 16 +++++++--------- board/gdsys/405ep/dlvision-10g.c | 7 ++++--- board/gdsys/405ep/io.c | 7 ++++--- board/gdsys/405ep/iocon.c | 7 ++++--- board/gdsys/dlvision/dlvision.c | 7 ++++--- board/gdsys/gdppc440etx/gdppc440etx.c | 7 ++++--- board/gdsys/intip/intip.c | 7 ++++--- board/gdsys/neo/neo.c | 7 ++++--- board/gw8260/gw8260.c | 8 ++++---- board/hermes/hermes.c | 16 +++++++--------- board/ixdp425/ixdp425.c | 7 ++++--- board/lwmon5/lwmon5.c | 7 ++++--- board/micronas/vct/vct.c | 7 ++++--- board/ml2/ml2.c | 18 +++++++----------- board/mosaixtech/icon/icon.c | 7 ++++--- board/pcs440ep/pcs440ep.c | 7 ++++--- board/prodrive/alpr/alpr.c | 9 +++++---- board/prodrive/p3mx/p3mx.c | 7 ++++--- board/prodrive/p3p440/p3p440.c | 7 ++++--- board/prodrive/pdnb3/pdnb3.c | 7 ++++--- board/quad100hd/quad100hd.c | 7 ++++--- board/quantum/quantum.c | 10 ++++++---- board/rbc823/rbc823.c | 9 +++++---- board/socrates/socrates.c | 12 +++++++----- board/svm_sc8xx/svm_sc8xx.c | 32 +++++++++++++++++--------------- board/t3corp/t3corp.c | 7 ++++--- board/ti/omap5912osk/omap5912osk.c | 7 ++++--- board/tqc/tqm8260/tqm8260.c | 8 ++++---- board/tqc/tqm8272/tqm8272.c | 8 ++++++-- board/tqc/tqm85xx/tqm85xx.c | 19 +++++++++++-------- board/tqc/tqm8xx/tqm8xx.c | 18 ++++++++++-------- board/xes/common/board.c | 17 +++++++++++------ board/xes/xpedite1000/xpedite1000.c | 21 +++++++++++---------- board/zeus/zeus.c | 7 ++++--- 61 files changed, 323 insertions(+), 259 deletions(-) (limited to 'board') diff --git a/board/LEOX/elpt860/elpt860.c b/board/LEOX/elpt860/elpt860.c index 905df92b1..03868cdd7 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 9d016c59d..0182d8a33 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 e73aff8ce..85e3f9e6c 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 d6aaad620..0d67f80b9 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 63bf365b8..bace2547e 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 482561122..68a99bd1e 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 d4205e034..79788a80f 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 fe8929c38..584f5effc 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 49eadb921..1ed0aeeaf 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 80e2739fe..2f0d94172 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 923dbca71..ad9439497 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 7301cd595..34380658e 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 bd6550cd0..1648734ab 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 b2595a8ec..d4b620e85 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 483df6627..34a094fc7 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 bbb5331ef..d2091e5bf 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 bb7565e2e..8ca14954c 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 b518aa7d7..45e87f763 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 87c9403e4..8c6b0977a 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 2957a7748..fcaf7fde2 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 4f299324c..d3287cea1 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 aaeab6f5f..0c95c3634 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 b128e46c2..1fab794bd 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 c8dd99eb4..64de04ca2 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 e671a7bed..c975efa39 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 717a64bb8..348dfa0af 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 9f13a3d10..588facefe 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 d6f638af6..abefe4a48 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 038854161..ecba66ec7 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 0974019ef..db1ea7f0c 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 20770e4ef..ce5334089 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 3499bdc68..5c70326d5 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 328eb95aa..c58411ee8 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 aa85ea416..0132b2595 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 a56c2cc98..d21d599fa 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 28f5ca99e..77a1e1d3a 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 9a3e5f669..acf364e2b 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 43ac8f6a4..a29d58438 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 dd275bf77..ecd953614 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 7fc3507b0..a8eef370e 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 981e1decd..319dca09d 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 e09dbc3df..e464e4395 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 70d8fe2c3..5a3ec5844 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 178498235..a64f6b09c 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 05eca52e0..09e4f823f 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 020f66dd8..1bb9686a3 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 928dd2222..3aaebf243 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 2f72d2b1b..6044e8558 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 d94b5d72a..61c6a68b8 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 e10d9f9ff..ddfba1491 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 72e7401f1..65fb70ad7 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 4390e49dd..f34b83515 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 f2853e42e..57f09fa36 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 cbf451baa..6f0e763f0 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 95073b844..65a3174ec 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 96ec078fd..9efb54125 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 99b13311c..8fb73abde 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 6576e0288..1fda53b9a 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 738f0a648..4e60bb505 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 a3534d2d7..4b0ee9281 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 7e33d3f38..18cb85faf 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'); -- cgit v1.2.3