Skip to content

Commit 4b48512

Browse files
Jiri SlabyIngo Molnar
authored andcommitted
stacktrace: Get rid of unneeded '!!' pattern
My commit b0c51f1 ("stacktrace: Don't skip first entry on noncurrent tasks") adds one or zero to skipnr by "!!(current == tsk)". But the C99 standard says: The == (equal to) and != (not equal to) operators are ... Each of the operators yields 1 if the specified relation is true and 0 if it is false. So there is no need to prepend the above expression by "!!" -- remove it. Reported-by: Joe Perches <[email protected]> Signed-off-by: Jiri Slaby <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 31f4f5b commit 4b48512

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/stacktrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *tsk, unsigned long *store,
142142
.store = store,
143143
.size = size,
144144
/* skip this function if they are tracing us */
145-
.skip = skipnr + !!(current == tsk),
145+
.skip = skipnr + (current == tsk),
146146
};
147147

148148
if (!try_get_task_stack(tsk))
@@ -300,7 +300,7 @@ unsigned int stack_trace_save_tsk(struct task_struct *task,
300300
.entries = store,
301301
.max_entries = size,
302302
/* skip this function if they are tracing us */
303-
.skip = skipnr + !!(current == task),
303+
.skip = skipnr + (current == task),
304304
};
305305

306306
save_stack_trace_tsk(task, &trace);

0 commit comments

Comments
 (0)