[U-Boot] [PATCH v3 2/7] malloc_f: fix broken .config caused by CONFIG_SYS_MALLOC_F

Simon Glass
2015-02-20T17:11:26Z

Hi Masahiro,

On 19 February 2015 at 22:24, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> Since commit b724bd7d6349 (dm: Kconfig: Move CONFIG_SYS_MALLOC_F_LEN
> to Kconfig), the ".config" created by the configuration has been
> wrong.
>
> For example, the following is a snippet of the ".config" generated
> by "make beaver_defconfig":
>
> --------------->8-----------------
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> # CONFIG_SYS_MALLOC_F is not set
> CONFIG_SYS_MALLOC_F_LEN=0x1800
> # CONFIG_EXPERT is not set
> ---------------8<-----------------
>
> CONFIG_SYS_MALLOC_F_LEN is supposed to depend on CONFIG_SYS_MALLOC_F
> (see the top level Kconfig), but the ".config" above is not actually
> following that dependency.
>
> This is caused by two mistakes of commit b724bd7d6349.
>
> [1] Wrong default value of CONFIG_SYS_MALLOC_F
> CONFIG_SYS_MALLOC_F is a boolean option, but its default value is
> set to 0x400.
>
> [2] Missing "if SYS_MALLOC_F" in the default setting in each Kconfig
> For example, arch/arm/cpu/armv7/tegra-common/Kconfig has the line
> "default 0x1800" for SYS_MALLOC_F_LEN. It must be described as
> "default 0x1800 if SYS_MALLOC_F" to follow the dependency.
>
> Those two bugs together create such a broken ".config".
>
> Unfortunately, even if we correct both [1] and [2], the value of
> CONFIG_SYS_MALLOC_F_LEN is not set as we expect.
> The "default 0x1800 if SYS_MALLOC_F" would be simply ignored because
> the "default 0x400" in the top level Kconfig is parsed first.
>
> Notice that if multiple default lines appear for the same CONFIG,
> the first one takes precedence.
>
> This commit corrects [1] and [2] so as not to create a broken
> .config file in any cases. Note that the default values in
> arch/arm/cpu/armv7/tegra-common/Kconfig and arch/x86/Kconfig are not
> working at this moment. This will be solved by the next commit.
>
> The default value 0x400 is redundant for OMAP, Exynos, UniPhier, etc.
> They can be simply removed.
>
> There are still redundant "CONFIG_SYS_MALLOC_F_LEN=0x400" in many
> defconfig files, but this commit is not touching them.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>
> Changes in v3:
> - Drop comments "This is meaningless ..."
> - Update commit description
>
> Changes in v2: None

I think it might have been better for this patch to merge with patch
4, since patch 3 fixes one of these problem. But it's not important.

Reviewed-by: Simon Glass <sjg@chromium.org