From 4396358fd314d5cf4dfb01b6d7176159707df226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Sun, 17 Oct 2021 17:48:50 +0200 Subject: [PATCH] kconfig_lint: use just one variable for keeping track of choices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: I2f1171789af6815094446f107f3c634332a3427e Reviewed-on: https://review.coreboot.org/c/coreboot/+/58401 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- util/lint/kconfig_lint | 13 +++---------- 1 file 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}++;