summaryrefslogtreecommitdiff
path: root/common/hwconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/hwconfig.c')
-rw-r--r--common/hwconfig.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 3c9759f..193863a 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -68,14 +68,14 @@ 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
static const char *__hwconfig(const char *opt, size_t *arglen)
{
- const char *env_hwconfig = NULL;
+ const char *env_hwconfig = NULL, *ret;
char buf[HWCONFIG_PRE_RELOC_BUF_SIZE];
if (gd->flags & GD_FLG_ENV_READY) {
@@ -92,19 +92,20 @@ static const char *__hwconfig(const char *opt, size_t *arglen)
env_hwconfig = buf;
}
- if (env_hwconfig)
- return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
+ if (env_hwconfig) {
+ ret = hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
opt, ";", ':', arglen);
+ if (ret)
+ return ret;
+ }
- if (board_hwconfig)
- return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
- opt, ";", ':', arglen);
+ ret = hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
+ opt, ";", ':', arglen);
+ if (ret)
+ return ret;
- if (cpu_hwconfig)
- return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
- opt, ";", ':', arglen);
-
- return NULL;
+ return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
+ opt, ";", ':', arglen);
}
/*