memregion: fix cache invalidation warning message
PATCH 1/1 memregion: fix cache invalidation warning message
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.
--- include/linux/memregion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/memregion.h +1 -1
@@ -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
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 7 lines · Karl Mehltretter
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.
Quoted 6 lines
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 coccinelleSigned-off-by Karl Mehltretter <[email protected]>
Friendly ping on this patch.
Updating Jonathan's Cc address to [email protected], as the original submission bounced at his old Huawei address.
Thanks,
Karl
Jonathan Cameron
Acked-byQuoted 11 lines · On Sat, 12 Sep 2026 11:19:57 +0200 Karl Mehltretter <[email protected]>…
Quoted 10 lines · Karl Mehltretter
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.
Quoted 8 lines
Quoted 3 lines
Fixes 1156b4418db0 ("memregion: Add cpu_cache_invalidate_memregion() interface")Assisted-by Claude:claude-fable-5 coccinelleSigned-off-by Karl Mehltretter <[email protected]>Friendly ping on this patch.
Updating Jonathan's Cc address to [email protected], as the original submission bounced at his old Huawei address.
Quoted 3 lines
Thanks,
Karl