bug: fix warning suppressions with kunit built as module

CONFIG_KUNIT is a tristate symbol but the warning suppression code in
lib/bug.c is only built if it's built-in due to it using a plain #ifdef,
rendering warning suppressions broken for kunit build as loadable module.

kunit_is_suppressed_warning() already has a stub for when kunit is
disabled so drop that guard entirely.

Link: https://lore.kernel.org/r/[email protected]
Suggested-by: Albert Esteve <[email protected]>
Cc: [email protected]
Fixes: 85347718ab ("bug/kunit: Core support for suppressing warning backtraces")
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Albert Esteve <[email protected]>
Reviewed-by: David Gow <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
This commit is contained in:
Bartosz Golaszewski authored and Shuah Khan committed 2026-07-10 10:26:58 -06:00
1 parent dc59e4fea9
commit 5142c56651
1 file changed
-2
-2
View File
@@ -219,14 +219,12 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
no_cut = bug->flags & BUGFLAG_NO_CUT_HERE;
has_args = bug->flags & BUGFLAG_ARGS;
#ifdef CONFIG_KUNIT
/*
* Before the once logic so suppressed warnings do not consume
* the single-fire budget of WARN_ON_ONCE().
*/
if (warning && kunit_is_suppressed_warning(true))
return BUG_TRAP_TYPE_WARN;
#endif
disable_trace_on_warning();