diff --git a/board/LEOX/elpt860/elpt860.c b/board/LEOX/elpt860/elpt860.c index 905df92b1dd974db425ec365f85b99be34b7f590..03868cdd7394998fd9129bfbe5374b72595ee8ff 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 9d016c59d3c42a24fe5fe9ca19ec0439948f8038..0182d8a3350439269dfebeba1468550ed8a213a7 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 e73aff8ced7d7b0a1cf9dc148ebb7157236ae1d5..85e3f9e6c4df69bc390ba4c9238fa9d7889b84f2 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 d6aaad6201aa5544d906d2cc69bcb7f3e82e965d..0d67f80b97eb36145755e7f307693048c7a86abb 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 63bf365b8a3dc414a87f78feffff3127591405db..bace2547e15477885ad9ba7998c1e73a58d15c5c 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 482561122ae57533488218cc6c1a1feccb06ddef..68a99bd1ee92823aa36b54ebf204e47498c18fbb 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 d4205e034ba4a7980d3d9d7f1a96a7d9e3c1f9aa..79788a80fc60924ac71a768b72cf6ad7df5532d9 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 fe8929c389cb4031f8b65a045d5a4f5a07ecd401..584f5effc62d36eb82bf55474725b458e06800bf 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 49eadb9212e87e40c248ae02a631fb6820778afa..1ed0aeeaf91f2a5ec146fe08d691488448fe479e 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 80e2739fe011218e7c09fda94e617c3cdf7971b0..2f0d94172ba7ad2e8a42bac23147ebc81ecb025a 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 923dbca718d55f01596b2f9e91223bd77bcf478c..ad9439497c9cda01afea8ea74e950311ca51238f 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 7301cd5953ae380066ca5f5760b7d23761ba7b20..34380658e5e05300d676a7a93156da75b6e4ffb5 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 bd6550cd05b7d8bfab625da01eb5eb4d676941d1..1648734ab619845f30d583a3d7b6f94104877944 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 b2595a8ec1a8c29f6521c6119f361948c50d7462..d4b620e857095681e0b3ef3ff32e4e6652a41d48 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 483df662723c3a3c7c29bc75375e374da1d8d7c6..34a094fc769640d4155aa6ac6550eedec20537ff 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 bbb5331ef2ef7534929427f27df9d82125a70ddb..d2091e5bf413be3ce9a32d49542f3a0c965caa10 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 bb7565e2e4304986da974d9a14925138d6d720fd..8ca14954c7f8f8f48e4310e04f09b92777f8bca1 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 b518aa7d72fc2e579d9cfdd42ba06e0c4c1be5f6..45e87f7631855385cbaf9dadd4aa36f151aae265 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 87c9403e4a84286f92d26cfd591d65184e273138..8c6b0977aaeba342aebd577e0c6a0606f932da25 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 2957a7748622ed12ccd44f538c422ffde00637d4..fcaf7fde265bba7ee31d43aaba47333f1b302bb5 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 4f299324cd751585f813233e4868543ab5158702..d3287cea194e3d813d18ef6c169f85dce82bfd0e 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 aaeab6f5fd35fadf926f9ed26afba62aa4c98fad..0c95c3634b1cc5e07f6582a3686bc1c8467b58b6 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 b128e46c2766953c4148f77a0d6750fbd9a02cb2..1fab794bd310bc237e4c0cfc7c5321b425fffdca 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 c8dd99eb4cb6f13e549ddaf36630ddaac552c7e4..64de04ca29dfc212a52c6fd07a3815efc252dc67 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 e671a7bed12ff5fe6dfb7c04f3e68d0941ba13ae..c975efa395f0895598b1f599044f6fa8c57527f6 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 717a64bb802fa9bdd5aec46b38e304849046eb22..348dfa0af36d6d60af48e99a48aafef5f7666184 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 9f13a3d1070fb946f82a106e2b579a99ef614b16..588facefef409acfa53acdb8b8be7d04121338b5 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 d6f638af65c4103d5824605ce5c66f96f05aff20..abefe4a4820d0b51739df117aa88c390b6d43c39 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 038854161fc505ee3df975d916cc803dfec3be67..ecba66ec71be6b3cea945e8cb737ed1de5fc804d 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 0974019ef7f2be64023e27ad349b6572c7dfd15f..db1ea7f0c57df0e2aa05b8a8cebadb0c10bbf18c 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 20770e4eff99a73e8efbcfa31019706ffe950622..ce533408943e7a0ff7ddabbd105ccec64160f06a 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 3499bdc685fe54e2a3131af469d09dbe43f1285e..5c70326d50cf16a0549dff87b6df1071b39bebdd 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 328eb95aa3da57576ce7d88bffdb0a2c7260475d..c58411ee888e631fe32bc035814b054267701ea8 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 aa85ea416a63037acca11ccde2fa4913d5fac60b..0132b2595d583bcb8b0cdd406690b07d4d2467a6 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 a56c2cc98794d688c0fa9fb2a7f40910c35ceed6..d21d599fa70ecaa8b6cff4ba2a30b452e287250b 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 28f5ca99e87db3d847f404592d11621b090d651f..77a1e1d3ac1624779e169ce77984eed5f8d8f1a9 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 9a3e5f669092ffb19851ee6ad2d2d7464a7b4f90..acf364e2b90b6eb17e43195ba1c256831ec99f30 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 43ac8f6a42a6e9aa5e5ae6f9154d98887cb360b3..a29d5843892c20dd5010ad43bd5fea4dd1f7d334 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 dd275bf777d686f986602ad7f4d4178eb2cb10f6..ecd9536145a63dfce56308a2a22e8b555ed4deea 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 7fc3507b0e10ccfc27d29adbf8cbae67391f9f35..a8eef370e0ea88e56fdf5ee10ad72983a32f7938 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 981e1decda55ca2e11d043eb42b2aec0f38ecddb..319dca09db08e0903667f5f442b55c53580d65b8 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 e09dbc3df0d2fddc5b09267ac87f765b644f6b5a..e464e4395cadc659a275937cb821550db7dcdcd7 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 70d8fe2c378417fcaaf15dc4a28a605bb88b921b..5a3ec584451bbd502cdce86a69f50a3bf95e8f58 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 178498235e32b59fad9c014d471a07d4dab26f4e..a64f6b09c9cedc38189dda2ac2decacbf710ab35 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 05eca52e0e86f0116c29c8b919b12d58c406cb94..09e4f823f0147f88b0ed1b8a23a4bbffa0de4c4b 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 020f66dd8eab0ddd44635f856f2f973db66169d7..1bb9686a3b7b37539d97faa1f92d9e9629c9e4a3 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 928dd2222d4a07684cf25c6fdbdc2e0b6ed23ecc..3aaebf24396ef894cb3fe6bbb07a38ab346afc3b 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 2f72d2b1bee2bac737a9b5631c657c8ae82f5d8b..6044e85585a8b603b459c2fe0f9774528a698561 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 d94b5d72a47cfca6a9ee77061abc1e28c7be6b0e..61c6a68b87e51c280860e64f0d3145a9cc2a2ff5 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 e10d9f9ff01cdac620c2e871d242e6a804ec4793..ddfba14919946a349fde9f2e26d451fa172fe11c 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 72e7401f14c355050c454ad7460fdf79c05ee6fc..65fb70ad73041058348070c8c051ae2fae23144b 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 4390e49dd1c38b5c828d78c360deac8e4c5e7124..f34b83515e8fdc845d74e7503f226d8b8f069ed6 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 f2853e42e58c4636b9728092f062de33a62b9667..57f09fa36710ba61ab0a7f01d8765f30f691e48c 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 cbf451baaf2f82753950154ba8695926c4355225..6f0e763f0117ec0a6ed0c7ea7d5917cfdaf0eaab 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 95073b8446d1ae84335caae301f3b0d562181045..65a3174ec681cd268856589208a7f5481bc71aa2 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 96ec078fd93e896067deea2208181a29218aa36a..9efb54125ec126f1d3fbc90d76a8f3bcb042858d 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 99b13311cefde00ae3a849123c936a702e6140c6..8fb73abde7ca338000361e4d2c08ac55836f959b 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 6576e0288ac9901ff0084208430592cc159a79e0..1fda53b9aec706029b4fd329c60972ec5a2dae1b 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 738f0a6486b483395a2c7f37bb8b3144e5b868ac..4e60bb505576d2d92c012d920d7e5f70044ca92a 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 a3534d2d7abfab522216fc0e466a71b68d2e0e02..4b0ee9281f170f441da6dbb86c24a3c6101daa67 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 7e33d3f38318d24e5e178124653a6935e99edc10..18cb85faf3371797bb18a10ee1fab9427ade3deb 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');