Skip to contentSkip to conversation

staging: mm: Fix ERROR:do not initialise statics to 0 or NULL in memblock.c

PATCH Superseded Kushal Kothari 2 participants 3 messages Nov 1, 2021 – Nov 3, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: mm: Fix ERROR:do not initialise statics to 0 or NULL in memblock.c

The default value of static variable is zero and bool is false so not need to set it here.
This patch fixes this ERROR in memblock.c

---
 mm/memblock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/memblock.c +4 -4
index 5c3503c98b2f..57b9153b2278 100644
@@ -16,7 +16,7 @@
 #include <linux/kmemleak.h>
 #include <linux/seq_file.h>
 #include <linux/memblock.h>
-
+#include<stdbool.h>
 #include <asm/sections.h>
 #include <linux/io.h>
 
@@ -152,10 +152,10 @@ static __refdata struct memblock_type *memblock_memory = &memblock.memory;
 	} while (0)
 
 static int memblock_debug __initdata_memblock;
-static bool system_has_some_mirror __initdata_memblock = false;
+static bool system_has_some_mirror __initdata_memblock;
 static int memblock_can_resize __initdata_memblock;
-static int memblock_memory_in_slab __initdata_memblock = 0;
-static int memblock_reserved_in_slab __initdata_memblock = 0;
+static int memblock_memory_in_slab __initdata_memblock;
+static int memblock_reserved_in_slab __initdata_memblock;
 
 static enum memblock_flags __init_memblock choose_memblock_flags(void)
 {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 3 lines · Kushal Kothari

The default value of static variable is zero and bool is false so not need to set it here.
This patch fixes this ERROR in memblock.c

Why does the subject line say "staging"? What tool reports this as an "ERROR"?

Quoted 10 lines
---
 mm/memblock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/memblock.c +0 -0
index 5c3503c98b2f..57b9153b2278 100644

mm/memblock.c line 19

Quoted 5 lines
mm/memblock.c +1 -1
@@ -16,7 +16,7 @@
 #include <linux/kmemleak.h>
 #include <linux/seq_file.h>
 #include <linux/memblock.h>
-
+#include<stdbool.h>

Why are you including stdbool here? Why do you not justify it in the changelog?

#2 lore raw
Quoted 2 lines

Why does the subject line say "staging"? What tool reports this as an "ERROR"?

Sorry. I made a mistake there while writing the subject line and adding <stdbool.h>.
I am fixing it in v2.
I ran the checkpatch.pl script which reported this error.

Quoted 28 lines · Matthew Wilcox
Quoted 3 lines · Kushal Kothari

The default value of static variable is zero and bool is false so not need to set it here.
This patch fixes this ERROR in memblock.c

Why does the subject line say "staging"? What tool reports this as an "ERROR"?

Quoted 10 lines
---
 mm/memblock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/memblock.c +0 -0
index 5c3503c98b2f..57b9153b2278 100644

mm/memblock.c line 19

Quoted 5 lines
mm/memblock.c +1 -1
@@ -16,7 +16,7 @@
 #include <linux/kmemleak.h>
 #include <linux/seq_file.h>
 #include <linux/memblock.h>
-
+#include<stdbool.h>

Why are you including stdbool here? Why do you not justify it in the changelog?