summaryrefslogtreecommitdiff
path: root/common/console.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-05-03 16:12:26 +0300
committerTom Rini <trini@konsulko.com>2018-05-06 20:35:16 +0300
commit27b4225b3c81aefc0ded9bf62d0873e72725664d (patch)
tree001ceb67dce389777a2e756c631074c20c0154af /common/console.c
parentdba8070f447d9490406005b3f16f225effc85893 (diff)
downloadu-boot-27b4225b3c81aefc0ded9bf62d0873e72725664d.tar.xz
stdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly
With tighter build flags the fact that <stdio_dev.h> doesn't have a reference back to MAX_NAMES causes an error. Include <stdio.h> here and then in common/console.c use MAX_NAMES rather than 3 when working with stdio_names. Reported-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> Tested-by: Peter Robinson <pbrobinson@gmail.com>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/console.c b/common/console.c
index 0e0295514b..b9297e0fc4 100644
--- a/common/console.c
+++ b/common/console.c
@@ -847,7 +847,7 @@ done:
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
/* set the environment variables (will overwrite previous env settings) */
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < MAX_FILES; i++) {
env_set(stdio_names[i], stdio_devices[i]->name);
}
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
@@ -926,7 +926,7 @@ int console_init_r(void)
#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
/* Setting environment variables */
- for (i = 0; i < 3; i++) {
+ for (i = 0; i < MAX_FILES; i++) {
env_set(stdio_names[i], stdio_devices[i]->name);
}