summaryrefslogtreecommitdiffstats
path: root/common/hwconfig.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2010-11-30 15:01:28 -0600
committerWolfgang Denk <wd@denx.de>2010-11-30 22:11:19 +0100
commitb194577b2995eacbd2a3769269f0af1bc5e22530 (patch)
tree375a09de7144df6e527ba3c91de5396ded94cec2 /common/hwconfig.c
parenta55bb8340ba8682782f816f0b9b3de13e5512e28 (diff)
downloadblackbird-obmc-uboot-b194577b2995eacbd2a3769269f0af1bc5e22530.tar.gz
blackbird-obmc-uboot-b194577b2995eacbd2a3769269f0af1bc5e22530.zip
hwconfig: Fix dummy initialization of {board, cpu}_hwconfig
Since board_hwconfig & cpu_hwconfig are defined as weak and dont have a default value they will get put into the BSS if they aren't defined elsewhere. This is problematic as we try to utilize hwconfig before we've relocated and thus BSS isn't setup. Instead of giving dummy values in the board files that utilize this feature, we can just initialize the variables to an empty string and thus move them out of the BSS if they aren't defined elsewhere. Also made board_hwconfig & cpu_hwconfig arrays to reduce size associated with string pointers vs arrays. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'common/hwconfig.c')
-rw-r--r--common/hwconfig.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 3c9759fc55..da8d3edb07 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -68,8 +68,8 @@ next:
return NULL;
}
-const char *cpu_hwconfig __attribute__((weak));
-const char *board_hwconfig __attribute__((weak));
+const char cpu_hwconfig[] __attribute__((weak)) = "";
+const char board_hwconfig[] __attribute__((weak)) = "";
#define HWCONFIG_PRE_RELOC_BUF_SIZE 128
@@ -96,13 +96,11 @@ static const char *__hwconfig(const char *opt, size_t *arglen)
return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
opt, ";", ':', arglen);
- if (board_hwconfig)
- return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
- opt, ";", ':', arglen);
+ return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
+ opt, ";", ':', arglen);
- if (cpu_hwconfig)
- return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
- opt, ";", ':', arglen);
+ return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
+ opt, ";", ':', arglen);
return NULL;
}
OpenPOWER on IntegriCloud