public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] modpost: Declare extra_warn with unused attribute
@ 2026-03-26  1:20 Nathan Chancellor
  0 siblings, 0 replies; only message in thread
From: Nathan Chancellor @ 2026-03-26  1:20 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, Jeff Johnson,
	Masahiro Yamada, linux-kbuild, linux-kernel, llvm, stable

A recent strengthening of -Wunused-but-set-variable (enabled with -Wall)
in clang under a new subwarning, -Wunused-but-set-global, points out an
unused static global variable in scripts/mod/modpost.c:

  scripts/mod/modpost.c:59:13: error: variable 'extra_warn' set but not used [-Werror,-Wunused-but-set-global]
     59 | static bool extra_warn;
        |             ^

This variable has been unused since commit 6c6c1fc09de3 ("modpost:
require a MODULE_DESCRIPTION()") but that is expected, as there are
currently no extra warnings at W=1 right now. Declare the variable with
the unused attribute to make it clear to the compiler that this variable
may be unused.

Cc: stable@vger.kernel.org
Fixes: 6c6c1fc09de3 ("modpost: require a MODULE_DESCRIPTION()")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I will apply this to kbuild-fixes for 7.0.
---
 scripts/mod/modpost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0c25b5ad497b..c3bc801d8b2d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -56,7 +56,7 @@ static bool allow_missing_ns_imports;
 
 static bool error_occurred;
 
-static bool extra_warn;
+static bool extra_warn __attribute__((unused));
 
 bool target_is_big_endian;
 bool host_is_big_endian;

---
base-commit: d2a43e7f89da55d6f0f96aaadaa243f35557291e
change-id: 20260325-modpost-extra_warn-unused-but-set-global-06fa6cd6750d

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-26  1:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26  1:20 [PATCH] modpost: Declare extra_warn with unused attribute Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox