Skip to contentSkip to conversation

alloc_tag: Use str_on_off() helper

PATCH Applied Kuan-Wei Chiu 1 participant 1 message Aug 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alloc_tag: Use str_on_off() helper

Replace the ternary (enable ? "on" : "off") with the str_on_off() helper from string_choices.h. This improves readability by replacing the three-operand ternary with a single function call, ensures consistent string output, and allows potential string deduplication by the linker, resulting in a slightly smaller binary.

---
Compiled test only.

 lib/alloc_tag.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/alloc_tag.c +2 -1
index e9b33848700a..d4449205eca2 100644
@@ -9,6 +9,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_buf.h>
 #include <linux/seq_file.h>
+#include <linux/string_choices.h>
 #include <linux/vmalloc.h>
 #include <linux/kmemleak.h>
 
@@ -726,7 +727,7 @@ static int __init setup_early_mem_profiling(char *str)
 		}
 		mem_profiling_support = true;
 		pr_info("Memory allocation profiling is enabled %s compression and is turned %s!\n",
-			compressed ? "with" : "without", enable ? "on" : "off");
+			compressed ? "with" : "without", str_on_off(enable));
 	}
 
 	if (enable != mem_alloc_profiling_enabled()) {
Signature · 1 line
2.34.1