diff options
author | Michael Niewöhner <foss@mniewoehner.de> | 2021-10-17 17:48:50 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-10-20 15:52:16 +0000 |
commit | 4396358fd314d5cf4dfb01b6d7176159707df226 (patch) | |
tree | f26b068f173d1dfcc28fe0859f2390dbcf8a87e9 /util | |
parent | 70fb5cb514399db41a95849827c039b6c66ddbd7 (diff) |
kconfig_lint: use just one variable for keeping track of choices
Instead of using two variables, one for the boolean value and one for
the path, use just one with the path. Since an empty string evalutes to
false, this simplification does not change behaviour.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Change-Id: I2f1171789af6815094446f107f3c634332a3427e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58401
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util')
-rwxr-xr-x | util/lint/kconfig_lint | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 9e2c207866..a3495ce2bf 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -374,7 +374,7 @@ sub check_defaults { # Symbols created/used inside a choice must not have a default set. The default is set by the choice itself. if ($symbols{$sym}{choice}) { show_error("Defining a default for symbol '$sym' at $filename:$line_no, used inside choice at " - . "$symbols{$sym}{choice_loc}, is not allowed."); + . "$symbols{$sym}{choice}, is not allowed."); } # skip good defaults @@ -802,15 +802,8 @@ sub add_symbol { #initialize the symbol or increment the use count. if ( ( !exists $symbols{$symbol} ) || ( !exists $symbols{$symbol}{count} ) ) { $symbols{$symbol}{count} = 0; - if ($inside_choice) { - $symbols{$symbol}{choice} = 1; - - # remember the location of the choice - $symbols{$symbol}{choice_loc} = $inside_choice; - } - else { - $symbols{$symbol}{choice} = 0; - } + # remember the location of the choice (or "") + $symbols{$symbol}{choice} = $inside_choice; } else { $symbols{$symbol}{count}++; |