kconfig: fix MODULES-related bug in case of no .config
[sfrench/cifs-2.6.git] / scripts / kconfig / confdata.c
index c4dec80cfd8e14a94792af807da0e9705256257d..8dce5862550db06e857170fab294621dc17ecbf9 100644 (file)
@@ -170,8 +170,11 @@ int conf_read_simple(const char *name, int def)
                if (in)
                        goto load;
                sym_add_change_count(1);
-               if (!sym_defconfig_list)
+               if (!sym_defconfig_list) {
+                       if (modules_sym)
+                               sym_calc_value(modules_sym);
                        return 1;
+               }
 
                for_all_defaults(sym_defconfig_list, prop) {
                        if (expr_calc_value(prop->visible.expr) == no ||
@@ -862,7 +865,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
                                sym->def[S_DEF_USER].tri = no;
                                break;
                        case def_random:
-                               sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
+                               cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
+                               sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
                                break;
                        default:
                                continue;