diff mbox series

mm/mm_init.c: Clean code. Use BUILD_BUG_ON when comparing compile time constant

Message ID 20200228224617.11343-1-mateusznosek0@gmail.com (mailing list archive)
State New, archived
Headers show
Series mm/mm_init.c: Clean code. Use BUILD_BUG_ON when comparing compile time constant | expand

Commit Message

Mateusz Nosek Feb. 28, 2020, 10:46 p.m. UTC
From: Mateusz Nosek <mateusznosek0@gmail.com>

MAX_ZONELISTS is compile time constant,
so it should be compared using BUILD_BUG_ON not BUG_ON.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
---
 mm/mm_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Yang March 2, 2020, 1:51 p.m. UTC | #1
On Fri, Feb 28, 2020 at 11:46:17PM +0100, mateusznosek0@gmail.com wrote:
>From: Mateusz Nosek <mateusznosek0@gmail.com>
>
>MAX_ZONELISTS is compile time constant,
>so it should be compared using BUILD_BUG_ON not BUG_ON.
>
>Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>

Sounds you are right.

Reviewed-by: Wei Yang <richard.weiyang@gmail.com>

>---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/mm/mm_init.c b/mm/mm_init.c
>index 5c918388de99..7da6991d9435 100644
>--- a/mm/mm_init.c
>+++ b/mm/mm_init.c
>@@ -37,7 +37,7 @@ void __init mminit_verify_zonelist(void)
> 		struct zonelist *zonelist;
> 		int i, listid, zoneid;
> 
>-		BUG_ON(MAX_ZONELISTS > 2);
>+		BUILD_BUG_ON(MAX_ZONELISTS > 2);
> 		for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
> 
> 			/* Identify the zone and nodelist */
>-- 
>2.17.1
diff mbox series

Patch

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 5c918388de99..7da6991d9435 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -37,7 +37,7 @@  void __init mminit_verify_zonelist(void)
 		struct zonelist *zonelist;
 		int i, listid, zoneid;
 
-		BUG_ON(MAX_ZONELISTS > 2);
+		BUILD_BUG_ON(MAX_ZONELISTS > 2);
 		for (i = 0; i < MAX_ZONELISTS * MAX_NR_ZONES; i++) {
 
 			/* Identify the zone and nodelist */