From 27b4225b3c81aefc0ded9bf62d0873e72725664d Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 3 May 2018 09:12:26 -0400 Subject: [PATCH] stdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly With tighter build flags the fact that doesn't have a reference back to MAX_NAMES causes an error. Include here and then in common/console.c use MAX_NAMES rather than 3 when working with stdio_names. Reported-by: Peter Robinson Signed-off-by: Tom Rini Tested-by: Peter Robinson --- common/console.c | 4 ++-- include/stdio_dev.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/console.c b/common/console.c index 0e02955..b9297e0 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); } diff --git a/include/stdio_dev.h b/include/stdio_dev.h index 1ea8bff..c2a88b4 100644 --- a/include/stdio_dev.h +++ b/include/stdio_dev.h @@ -8,6 +8,7 @@ #ifndef _STDIO_DEV_H_ #define _STDIO_DEV_H_ +#include #include /* -- 2.7.4