Skip to contentSkip to conversation

MIPS: tools: no need to initialise statics to 0

PATCH Applied Jason Wang 2 participants 2 messages May 8, 2022 – May 12, 2022 MIPS

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 MIPS: tools: no need to initialise statics to 0

Static variables do not need to be initialised to 0, because compiler will initialise all uninitialised statics to 0. Thus, remove the unneeded initializations.

---
 arch/mips/boot/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/boot/tools/relocs.c +1 -1
index 1bf53f3524b3..02fc85f3e8ff 100644
@@ -351,7 +351,7 @@ static void read_symtabs(FILE *fp)
 
 static void read_relocs(FILE *fp)
 {
-	static unsigned long base = 0;
+	static unsigned long base;
 	int i, j;
 
 	if (!base) {
Signature · 1 line
2.35.1
maintainer Applied
#1 lore raw
Quoted 24 lines · Jason Wang

Static variables do not need to be initialised to 0, because compiler will initialise all uninitialised statics to 0. Thus, remove the unneeded initializations.

---
 arch/mips/boot/tools/relocs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/boot/tools/relocs.c +1 -1
index 1bf53f3524b3..02fc85f3e8ff 100644
@@ -351,7 +351,7 @@ static void read_symtabs(FILE *fp)
 
 static void read_relocs(FILE *fp)
 {
-	static unsigned long base = 0;
+	static unsigned long base;
 	int i, j;
 
 	if (!base) {
Signature · 1 line
2.35.1

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]