mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memregion: fix cache invalidation warning message
@ 2026-08-08 12:19 Karl Mehltretter
  2026-09-12  9:19 ` Karl Mehltretter
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-08-08 12:19 UTC (permalink / raw)
  To: Dan Williams
  Cc: Karl Mehltretter, Dave Hansen, Jonathan Cameron, Davidlohr Bueso,
	linux-kernel, llvm

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 <kmehltretter@gmail.com>
---
 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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] memregion: fix cache invalidation warning message
  2026-08-08 12:19 [PATCH] memregion: fix cache invalidation warning message Karl Mehltretter
@ 2026-09-12  9:19 ` Karl Mehltretter
  0 siblings, 0 replies; 2+ messages in thread
From: Karl Mehltretter @ 2026-09-12  9:19 UTC (permalink / raw)
  To: Dan Williams
  Cc: Dave Hansen, Jonathan Cameron, Davidlohr Bueso, linux-kernel, llvm

On Sat, Aug 08, 2026 at 02:19:43PM +0100, Karl Mehltretter wrote:
> 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 <kmehltretter@gmail.com>

Friendly ping on this patch.

Updating Jonathan's Cc address to jic23@kernel.org, as the original
submission bounced at his old Huawei address.

Thanks,
Karl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-12  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-08 12:19 [PATCH] memregion: fix cache invalidation warning message Karl Mehltretter
2026-09-12  9:19 ` Karl Mehltretter

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

all inboxes | Powered by JetHome®