]> www.infradead.org Git - users/hch/misc.git/commitdiff
alloc_tag: use str_on_off() helper
authorKuan-Wei Chiu <visitorckw@gmail.com>
Thu, 14 Aug 2025 09:38:27 +0000 (17:38 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 14 Sep 2025 00:32:47 +0000 (17:32 -0700)
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.

Link: https://lkml.kernel.org/r/20250814093827.237980-1-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/alloc_tag.c

index e9b33848700a860cf9dc96a20bf7ea288974cd72..d4449205eca228071fdd19e085c73999dc631794 100644 (file)
@@ -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()) {