kconfig: remove meaningless if-conditional in conf_read()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 11 Jul 2019 07:33:17 +0000 (16:33 +0900)
committerChristian Lamparter <chunkeey@gmail.com>
Fri, 27 Sep 2019 20:36:44 +0000 (22:36 +0200)
sym_is_choice(sym) has already been checked by previous if-block:

    if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
            continue;

Hence, the following code is redundant, and the comment is misleading:

    if (!sym_is_choice(sym))
            continue;
    /* fall through */

It always takes 'continue', never falls though.

Clean up the dead code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/confdata.c

index a38b508788d8775af0f44cbbff0a5709fdcd3504..ab42aa650794e4f1a4bdc15ef65f23f404ad3b83 100644 (file)
@@ -534,11 +534,9 @@ int conf_read(const char *name)
                        switch (sym->type) {
                        case S_BOOLEAN:
                        case S_TRISTATE:
-                               if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
-                                       break;
-                               if (!sym_is_choice(sym))
+                               if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym))
                                        continue;
-                               /* fall through */
+                               break;
                        default:
                                if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
                                        continue;