diff options
author | Wolfgang Denk <wd@denx.de> | 2011-05-04 10:32:28 +0000 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-05-12 19:48:42 +0200 |
commit | f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675 (patch) | |
tree | b48adf0159f02551ab3318f469b085cfa0b26bb8 /board/amcc | |
parent | a02a884b95c47e114a54f2751d03f139f312af2f (diff) | |
download | u-boot-imx-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.zip u-boot-imx-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.tar.gz u-boot-imx-f0c0b3a9e6f28a34d6da5edabba1e874fdf8e675.tar.bz2 |
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>
Diffstat (limited to 'board/amcc')
-rw-r--r-- | board/amcc/acadia/acadia.c | 7 | ||||
-rw-r--r-- | board/amcc/bamboo/bamboo.c | 7 | ||||
-rw-r--r-- | board/amcc/bluestone/bluestone.c | 7 | ||||
-rw-r--r-- | board/amcc/bubinga/bubinga.c | 7 | ||||
-rw-r--r-- | board/amcc/canyonlands/canyonlands.c | 7 | ||||
-rw-r--r-- | board/amcc/ebony/ebony.c | 7 | ||||
-rw-r--r-- | board/amcc/katmai/katmai.c | 7 | ||||
-rw-r--r-- | board/amcc/kilauea/kilauea.c | 7 | ||||
-rw-r--r-- | board/amcc/luan/luan.c | 7 | ||||
-rw-r--r-- | board/amcc/makalu/makalu.c | 7 | ||||
-rw-r--r-- | board/amcc/ocotea/ocotea.c | 9 | ||||
-rw-r--r-- | board/amcc/redwood/redwood.c | 7 | ||||
-rw-r--r-- | board/amcc/sequoia/sequoia.c | 7 | ||||
-rw-r--r-- | board/amcc/taihu/taihu.c | 7 | ||||
-rw-r--r-- | board/amcc/taishan/taishan.c | 9 | ||||
-rw-r--r-- | board/amcc/walnut/walnut.c | 7 | ||||
-rw-r--r-- | board/amcc/yosemite/yosemite.c | 7 | ||||
-rw-r--r-- | board/amcc/yucca/yucca.c | 7 |
18 files changed, 74 insertions, 56 deletions
diff --git a/board/amcc/acadia/acadia.c b/board/amcc/acadia/acadia.c index 4825611..68a99bd 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 d4205e0..79788a8 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 fe8929c..584f5ef 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 49eadb9..1ed0aee 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 80e2739..2f0d941 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 923dbca..ad94394 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 7301cd5..3438065 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 bd6550c..1648734 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 b2595a8..d4b620e 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 483df66..34a094f 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 bbb5331..d2091e5 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 bb7565e..8ca1495 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 b518aa7..45e87f7 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 87c9403..8c6b097 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 2957a77..fcaf7fd 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 4f29932..d3287ce 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 aaeab6f..0c95c36 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 b128e46..1fab794 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'); |