Re: [PATCH] kconfig: warn on dead default

From: Julian Braha

Date: Tue Jul 07 2026 - 04:34:07 EST


Hi Nathan,

On 7/7/26 06:31, Nathan Chancellor wrote:
> Nicolas pushed this into -next, where it fires several times for me. I
> have not looked at these closely yet, I just wanted to get the report
> out so that more eyes could be on it.

Thank you for sharing, I've taken a close look.

> ARCH=powerpc allmodconfig:
>
> arch/powerpc/platforms/Kconfig.cputype:269:warning: default for 'TUNE_CPU' has the same condition as the earlier default at arch/powerpc/platforms/Kconfig.cputype:268
> arch/powerpc/platforms/Kconfig.cputype:270:warning: default for 'TUNE_CPU' has the same condition as the earlier default at arch/powerpc/platforms/Kconfig.cputype:268
> lib/Kconfig.debug:1083:warning: default for 'PANIC_TIMEOUT' is unreachable: earlier default at arch/powerpc/Kconfig:350 is unconditional
> arch/Kconfig:1194:warning: default for 'PGTABLE_LEVELS' is unreachable: earlier default at arch/powerpc/Kconfig:482 is unconditional
>
> ARCH=s390 allmodconfig:
>
> arch/Kconfig:1194:warning: default for 'PGTABLE_LEVELS' is unreachable: earlier default at arch/s390/Kconfig:295 is unconditional
> lib/Kconfig:372:warning: default for 'HAS_IOMEM' is unreachable: earlier default at arch/s390/Kconfig:760 is unconditional

It seems to me that all of these instances are probably intended by the
architectures to override the global default.

Personally, I find this redefine-and-override style confusing as it
requires the reader to think about the order of imports in kconfig. I'll
throw them in my kconfig cleanup pile, and see what the relevant
maintainers think of my version.

> When building with clang-23, which supports '-fms-anonymous-struct':
>
> init/Kconfig:978:warning: default for 'CC_MS_EXTENSIONS' is unreachable: earlier default at init/Kconfig:977 is unconditional
>
> I think the init/Kconfig and arch/powerpc/platforms/Kconfig.cputype ones
> are intentional due to how cc-option works but I know those might be
> hard to silence because they are already evaluated by this stage if I
> understand correctly? Not sure about the other ones (apologies if they
> are already known or have fixes).

Yeah, let's leave these alone.

Best not to merge this. Thank you all for taking a look.

- Julian Braha