[PATCH] memregion: fix cache invalidation warning message

Karl Mehltretter <[email protected]>
Newsgroups dev.linux.lists.llvm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
WARN_ON_ONCE() takes a condition, not a message. The string literal is
always true, so the warning still triggers but the message is never
printed.

Use WARN_ONCE(1, ...) instead to print the message 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.

Fixes: 1156b4418db0 ("memregion: Add cpu_cache_invalidate_memregion() interface")
Assisted-by: Claude:claude-fable-5 coccinelle
Signed-off-by: Karl Mehltretter <[email protected]>
---
 include/linux/memregion.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memregion.h b/include/linux/memregion.h
index a55f62cc5266..50a6d2ed432e 100644
--- a/include/linux/memregion.h
+++ b/include/linux/memregion.h
@@ -58,7 +58,7 @@ static inline bool cpu_cache_has_invalidate_memregion(void)
 
 static inline int cpu_cache_invalidate_memregion(phys_addr_t start, size_t len)
 {
-	WARN_ON_ONCE("CPU cache invalidation required");
+	WARN_ONCE(1, "CPU cache invalidation required");
 	return -ENXIO;
 }
 #endif
-- 
2.39.5 (Apple Git-154)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.