[PATCH for-next v2] tracing: optimize trace_buffer_iter()

From: yuan linyu
Date: Sun Apr 08 2018 - 07:37:46 EST


From: yuan linyu <Linyu.Yuan@xxxxxxxxxxxxxxxxxxxx>

use conditional operation.

Signed-off-by: yuan linyu <Linyu.Yuan@xxxxxxxxxxxxxxxxxxxx>
---
kernel/trace/trace.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 6fb46a06c9dc..bda717ab2095 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -582,9 +582,7 @@ static __always_inline void trace_clear_recursion(int bit)
static inline struct ring_buffer_iter *
trace_buffer_iter(struct trace_iterator *iter, int cpu)
{
- if (iter->buffer_iter && iter->buffer_iter[cpu])
- return iter->buffer_iter[cpu];
- return NULL;
+ return iter->buffer_iter ? iter->buffer_iter[cpu] : NULL;
}

int tracer_init(struct tracer *t, struct trace_array *tr);
--
2.14.1