All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Braha <julianbraha@gmail.com>
To: nathan@kernel.org, nsc@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org
Cc: arnd@arndb.de, stefan.hengelein@fau.de,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, nico@fluxnic.net,
	officialnaumansabir@gmail.com, rdunlap@infradead.org,
	vegard.nossum@oracle.com, kees@kernel.org, tj@kernel.org,
	Julian Braha <julianbraha@gmail.com>
Subject: [PATCH] Documentation: warn users not to use select on choice options in Kconfig
Date: Wed, 15 Jul 2026 23:01:49 +0100	[thread overview]
Message-ID: <20260715220149.48700-1-julianbraha@gmail.com> (raw)

Hengelein's master thesis about Kconfig from 2015 wrote that 'select'
does not work on member options inside of a 'choice'.

So I've re-implemented his check as part of kconfirm:
https://github.com/julianbraha/kconfirm

and discovered several instances of these dead selects in use, and
fixing them is not always trivial. For example, see:
https://lore.kernel.org/all/a3b7a752-8cc4-492a-bb62-43121b852c41@app.fastmail.com/

Let's add a warning to the documentation (a place where developers
are more likely to see it than a master's thesis...)

Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
 Documentation/kbuild/kconfig-language.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst
index d9338407c1c6..ab2822d7ca1c 100644
--- a/Documentation/kbuild/kconfig-language.rst
+++ b/Documentation/kbuild/kconfig-language.rst
@@ -164,6 +164,11 @@ applicable everywhere (see syntax).
 	That will limit the usefulness but on the other hand avoid
 	the illegal configurations all over.
 
+	select should also not be used on the member options of a choice.
+	Selecting a choice option will do nothing (dead code). Instead,
+	consider making these a dependency, or using the defaults of the
+	choice to enable the member option when it's needed.
+
 	If "select" <symbol> is followed by "if" <expr>, <symbol> will be
 	selected by the logical AND of the value of the current menu symbol
 	and <expr>. This means, the lower limit can be downgraded due to the
-- 
2.54.0


             reply	other threads:[~2026-07-15 22:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 22:01 Julian Braha [this message]
2026-07-16  4:19 ` [PATCH] Documentation: warn users not to use select on choice options in Kconfig Kees Cook
2026-07-16  6:04   ` Julian Braha
2026-07-29 15:10     ` Jani Nikula
2026-07-21 10:59 ` Nicolas Schier
2026-08-02 19:13 ` Nicolas Schier
2026-08-02 19:36   ` Julian Braha
2026-08-03 17:47     ` Nathan Chancellor
2026-08-03 18:26       ` Julian Braha
2026-08-04 11:47         ` Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260715220149.48700-1-julianbraha@gmail.com \
    --to=julianbraha@gmail.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=kees@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nico@fluxnic.net \
    --cc=nsc@kernel.org \
    --cc=officialnaumansabir@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stefan.hengelein@fau.de \
    --cc=tj@kernel.org \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.