From fa934009cb7acf9323a5ee8a394a1b9513579d46 Mon Sep 17 00:00:00 2001 From: Aska Wu Date: Tue, 5 Dec 2017 17:27:27 +0800 Subject: [PATCH] subsys: console: Fix the buffer size checking Fix the problem that no compiler error even the buffer size is not power of 2. Signed-off-by: Aska Wu --- subsys/console/getchar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/console/getchar.c b/subsys/console/getchar.c index 175259757d3..748e56f099c 100644 --- a/subsys/console/getchar.c +++ b/subsys/console/getchar.c @@ -11,11 +11,11 @@ #include #include -#if CONFIG_CONSOLE_GETCHAR_BUFSIZE & (CONFIG_CONSOLE_GETCHAR_BUFSIZE - 1) != 0 +#if (CONFIG_CONSOLE_GETCHAR_BUFSIZE & (CONFIG_CONSOLE_GETCHAR_BUFSIZE - 1)) != 0 #error CONFIG_CONSOLE_GETCHAR_BUFSIZE must be power of 2 #endif -#if CONFIG_CONSOLE_PUTCHAR_BUFSIZE & (CONFIG_CONSOLE_PUTCHAR_BUFSIZE - 1) != 0 +#if (CONFIG_CONSOLE_PUTCHAR_BUFSIZE & (CONFIG_CONSOLE_PUTCHAR_BUFSIZE - 1)) != 0 #error CONFIG_CONSOLE_PUTCHAR_BUFSIZE must be power of 2 #endif