mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 22:09:30 +02:00
lib/interval_tree: fix allocation warning messages
WARN_ON_ONCE() takes a condition, not a message. The string literals are
always true, so the warnings still trigger but the messages are never
printed.
Use WARN_ONCE(1, ...) instead to print the messages and keep the once-only
behavior.
Found with a Coccinelle script. Clang's -Wstring-conversion also flags
such calls but is not enabled in kernel builds.
Link: https://lore.kernel.org/20260808123608.73613-1-kmehltretter@gmail.com
Fixes: 82114e4513 ("lib/interval_tree: add test case for interval_tree_iter_xxx() helpers")
Assisted-by: Claude:claude-fable-5 coccinelle
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
5779e0f30f
commit
d9c0fd5533
@@ -140,13 +140,13 @@ static int intersection_range_check(void)
|
||||
|
||||
intxn1 = bitmap_alloc(nnodes, GFP_KERNEL);
|
||||
if (!intxn1) {
|
||||
WARN_ON_ONCE("Failed to allocate intxn1\n");
|
||||
WARN_ONCE(1, "Failed to allocate intxn1\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
intxn2 = bitmap_alloc(nnodes, GFP_KERNEL);
|
||||
if (!intxn2) {
|
||||
WARN_ON_ONCE("Failed to allocate intxn2\n");
|
||||
WARN_ONCE(1, "Failed to allocate intxn2\n");
|
||||
bitmap_free(intxn1);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user