[PATCH v2] tracing/sched_switch: drop duplicated NO_CMDLINE_MAP check

From: Mingbing Zhai

Date: Thu Nov 26 2026 - 03:11:14 EST


NO_CMDLINE_MAP is defined as UINT_MAX, so "*ptr == -1" and
"*ptr == NO_CMDLINE_MAP" compare the same value: the signed -1
converts to UINT_MAX in the unsigned comparison. gcc -Wlogical-op
flags the duplicated condition. Drop the magic number and keep the
symbolic name, which is what the rest of the file uses.

Signed-off-by: Mingbing Zhai <zhaimingbing@xxxxxxxxxxxxxxxxxxxx>
---
kernel/trace/trace_sched_switch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 1bd351c1f..de58ff104 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -526,7 +526,7 @@ static void *saved_cmdlines_next(struct seq_file *m, void *v, loff_t *pos)

for (; ptr < &savedcmd->map_cmdline_to_pid[savedcmd->cmdline_num];
ptr++) {
- if (*ptr == -1 || *ptr == NO_CMDLINE_MAP)
+ if (*ptr == NO_CMDLINE_MAP)
continue;

return ptr;
--
2.43.0