Skip to contentSkip to conversation

kconfig: do not use OR-assignment for zero-cleared structure

PATCH In review Masahiro Yamada 1 participant 2 messages Apr 13, 2020 – Apr 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: do not use OR-assignment for zero-cleared structure

The simple assignment is enough because memset() three lines above has zero-cleared the structure.

---

 scripts/kconfig/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/symbol.c +1 -1
index 3dc81397d003..9363e37b8870 100644
@@ -831,7 +831,7 @@ struct symbol *sym_lookup(const char *name, int flags)
 	memset(symbol, 0, sizeof(*symbol));
 	symbol->name = new_name;
 	symbol->type = S_UNKNOWN;
-	symbol->flags |= flags;
+	symbol->flags = flags;
 
 	symbol->next = symbol_hash[hash];
 	symbol_hash[hash] = symbol;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 24 lines · Masahiro Yamada

The simple assignment is enough because memset() three lines above has zero-cleared the structure.

---

 scripts/kconfig/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/symbol.c +1 -2
index 3dc81397d003..9363e37b8870 100644
@@ -831,7 +831,7 @@ struct symbol *sym_lookup(const char *name, int flags)
        memset(symbol, 0, sizeof(*symbol));
        symbol->name = new_name;
        symbol->type = S_UNKNOWN;
-       symbol->flags |= flags;
+       symbol->flags = flags;
 
        symbol->next = symbol_hash[hash];
        symbol_hash[hash] = symbol;
--
Quoted 2 lines

2.25.1

Applied to linux-kbuild.

Signature · 2 lines
Best Regards
Masahiro Yamada