Re: [PATCH] mtd: maps: fix dead select of MTD_CFI_BE_BYTE_SWAP

Julian Braha <[email protected]> Wed, 22 Jul 2026 14:43:52 +0100
Newsgroups org.infradead.lists.linux-mtd,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Arnd,

On 7/22/26 08:42, Arnd Bergmann wrote:
>> 'select' does not work on config options in a 'choice', so currently it is
>> possible to enable MTD_PHYSMAP_IXP4XX without MTD_CFI_BE_BYTE_SWAP.
>>
>> Let's replace the select with 'depends on'.
>>
>> Note that, if we remove the select / dependency, the kernel will compile
>> with MTD_PHYSMAP_IXP4XX=y and MTD_CFI_BE_BYTE_SWAP=n so if it would be
>> better to remove the select, please advise as I do not have the hardware
>> to runtime test this.
>>
>> This dead select was found by kconfirm, a static analysis tool for Kconfig.
> The choice is forced to be MTD_CFI_BE_BYTE_SWAP when building for
> big-endian IXP4XX, which I think means this will currently always
> work correctly:
> 
> config MTD_CFI_NOSWAP
>         depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN
>         bool "NO"
> 
> config MTD_CFI_BE_BYTE_SWAP
>         bool "BIG_ENDIAN_BYTE"
> 
> config MTD_CFI_LE_BYTE_SWAP
>         depends on !ARCH_IXP4XX
>         bool "LITTLE_ENDIAN_BYTE"
> 
> endchoice

Actually it is currently possible to have:
MTD_PHYSMAP_IXP4XX=y
MTD_CFI_BE_BYTE_SWAP=n
CPU_BIG_ENDIAN=y

by not satisfying the dependencies of the choice that
MTD_CFI_BE_BYTE_SWAP is part of,
for example, set:
MTD_CFI_ADV_OPTIONS=n

then, none of the choice options are enabled. This is the
configuration that I had compile-tested (but cannot runtime test).

In any case, should I send a v2 removing the select, and leave the
rest of the little-endian ARCH_IXP4XX changes to you?

- Julian Braha

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/