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

Message ID 20200413153320.93316-1-masahiroy@kernel.org
State New
Headers show
Series
  • kconfig: do not use OR-assignment for zero-cleared structure
Related show

Commit Message

Masahiro Yamada April 13, 2020, 3:33 p.m. UTC
The simple assignment is enough because memset() three lines above
has zero-cleared the structure.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Masahiro Yamada April 25, 2020, 4:59 p.m. UTC | #1
On Tue, Apr 14, 2020 at 12:33 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> The simple assignment is enough because memset() three lines above
> has zero-cleared the structure.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/kconfig/symbol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index 3dc81397d003..9363e37b8870 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -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;
> --
> 2.25.1
>

Applied to linux-kbuild.

Patch
diff mbox series

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3dc81397d003..9363e37b8870 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -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;