• Sam Ravnborg's avatar
    kconfig: fix tristate choice with minimal config · a64b44ea
    Sam Ravnborg authored
    If a minimal config did not specify the value
    of all choice values, the resulting configuration
    could have wrong values.
    
    Consider following example:
    config M
            def_bool y
            option modules
    choice
            prompt "choice list"
    config A
            tristate "a"
    config B
    	tristate "b"
    endchoice
    
    With a defconfig like this:
    CONFIG_M=y
    CONFIG_A=y
    
    The resulting configuration would have
    
        CONFIG_A=m
    
    which was unexpected.
    
    The problem was not not all choice values were set and thus
    kconfig calculated a wrong value.
    
    The fix is to set all choice values when we
    read a defconfig files.
    
    conf_set_all_new_symbols() is refactored such that
    random choice values are now handled by a dedicated function.
    And new choice values are set by set_all_choice_values().
    
    This was not the minimal fix, but the fix that resulted
    in the most readable code.
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Reported-by: default avatarArve Hjønnevåg <arve@android.com>
    Tested-by: default avatarArve Hjønnevåg <arve@android.com>
    Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
    a64b44ea
confdata.c 21.7 KB