* [PATCH] kconfig: do not clear SYMBOL_DEF_USER when the value is out of range
@ 2023-11-05 18:10 Masahiro Yamada
0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2023-11-05 18:10 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
When a user-supplied value is out of range, (NEW) and an incorrect default
value are shown.
[Test Kconfig]
config FOO
int "foo"
range 10 20
[Test .config]
CONFIG_FOO=30
[Result without this fix]
$ make config
*
* Main menu
*
foo (FOO) [10] (NEW)
[Result with this fix]
$ make config
*
* Main menu
*
foo (FOO) [20]
Currently, the SYMBOL_DEF_USER is cleared if the user input does not
reside within the range. Kconfig forgets the initial value 30, and
prints (NEW) and an incorrect default [10].
Kconfig should remember the user's input. The default should be [20]
because the user's input, 30, is closer to the upper limit of the range.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/confdata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 4a6811d77d18..7fca9cc3ae74 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -594,7 +594,7 @@ int conf_read(const char *name)
/* Reset a string value if it's out of range */
if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
break;
- sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
+ sym->flags &= ~SYMBOL_VALID;
conf_unsaved++;
break;
default:
--
2.40.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-05 18:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-05 18:10 [PATCH] kconfig: do not clear SYMBOL_DEF_USER when the value is out of range Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®