[for-next][PATCH 3/8] tracing: Drop duplicated NO_CMDLINE_MAP check in saved_cmdlines_next()
From: Steven Rostedt
Date: Wed Dec 02 2026 - 03:15:15 EST
From: Mingbing Zhai <zhaimingbing@xxxxxxxxxxxxxxxxxxxx>
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.
Link: https://patch.msgid.link/20261126081103.4224-1-zhaimingbing@xxxxxxxxxxxxxxxxxxxx
Signed-off-by: Mingbing Zhai <zhaimingbing@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
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 1bd351c1fbfb..de58ff1046ec 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.53.0