kconfig: remove unneeded menu_is_visible() call in conf_write_defconfig()
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 10 Mar 2024 14:16:17 +0000 (23:16 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 18 Mar 2024 17:30:51 +0000 (02:30 +0900)
When the condition 'sym == NULL' is met, the code will reach the
'next_menu' label regardless of the return value from menu_is_visible().

menu_is_visible() calculates some symbol values as a side-effect, for
instance by calling expr_calc_value(menu->visibility), but all the
symbol values will be calculated eventually.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/confdata.c

index c5b6487d68ac4df209cb850ff8bb111d57b26807..0e35c4819cf1d2f71e998b11cac56cdfea9fbbc4 100644 (file)
@@ -799,10 +799,7 @@ int conf_write_defconfig(const char *filename)
        while (menu != NULL)
        {
                sym = menu->sym;
-               if (sym == NULL) {
-                       if (!menu_is_visible(menu))
-                               goto next_menu;
-               } else if (!sym_is_choice(sym)) {
+               if (sym && !sym_is_choice(sym)) {
                        sym_calc_value(sym);
                        if (!(sym->flags & SYMBOL_WRITE))
                                goto next_menu;