include/linux/memregion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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)
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
On Sat, 12 Sep 2026 11:19:57 +0200
Karl Mehltretter <kmehltretter@gmail.com> wrote:
> 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.
Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
>
> Thanks,
> Karl
© 2016 - 2026 Red Hat, Inc.