[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202211282110006083500@zte.com.cn>
Date: Mon, 28 Nov 2022 21:10:00 +0800 (CST)
From: <zhang.songyi@....com.cn>
To: <rostedt@...dmis.org>, <mhiramat@...nel.org>
Cc: <linux-kernel@...r.kernel.org>
Subject: [PATCH linux-next] ring_buffer: remove redundant ret variables
From: zhang songyi <zhang.songyi@....com.cn>
Return values from ring_buffer_bytes_cpu(), ring_buffer_overrun_cpu(),
ring_buffer_commit_overrun_cpu(), ring_buffer_dropped_events_cpu()
directly instead of taking this in another redundant variable.
Signed-off-by: zhang songyi <zhang.songyi@....com.cn>
---
kernel/trace/ring_buffer.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 843818ee4814..353c90ce7640 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -4224,15 +4224,13 @@ EXPORT_SYMBOL_GPL(ring_buffer_oldest_event_ts);
unsigned long ring_buffer_bytes_cpu(struct trace_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
- unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
- ret = local_read(&cpu_buffer->entries_bytes) - cpu_buffer->read_bytes;
- return ret;
+ return local_read(&cpu_buffer->entries_bytes) - cpu_buffer->read_bytes;
}
EXPORT_SYMBOL_GPL(ring_buffer_bytes_cpu);
@@ -4263,15 +4261,13 @@ EXPORT_SYMBOL_GPL(ring_buffer_entries_cpu);
unsigned long ring_buffer_overrun_cpu(struct trace_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
- unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
- ret = local_read(&cpu_buffer->overrun);
- return ret;
+ return local_read(&cpu_buffer->overrun);
}
EXPORT_SYMBOL_GPL(ring_buffer_overrun_cpu);
@@ -4286,15 +4282,13 @@ unsigned long
ring_buffer_commit_overrun_cpu(struct trace_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
- unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
- ret = local_read(&cpu_buffer->commit_overrun);
- return ret;
+ return local_read(&cpu_buffer->commit_overrun);
}
EXPORT_SYMBOL_GPL(ring_buffer_commit_overrun_cpu);
@@ -4308,15 +4302,13 @@ unsigned long
ring_buffer_dropped_events_cpu(struct trace_buffer *buffer, int cpu)
{
struct ring_buffer_per_cpu *cpu_buffer;
- unsigned long ret;
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return 0;
cpu_buffer = buffer->buffers[cpu];
- ret = local_read(&cpu_buffer->dropped_events);
- return ret;
+ return local_read(&cpu_buffer->dropped_events);
}
EXPORT_SYMBOL_GPL(ring_buffer_dropped_events_cpu);
--
2.15.2
Powered by blists - more mailing lists