* [PATCH] ring-buffer: simplify if-if to if-else
@ 2022-04-24 9:34 Wan Jiabing
2022-04-24 16:12 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Wan Jiabing @ 2022-04-24 9:34 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar, linux-kernel; +Cc: kael_w, Wan Jiabing
Use if and else instead of if(A) and if (!A).
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
kernel/trace/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 05dfc7a12d3d..0fa21bd1a1e9 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -6014,7 +6014,7 @@ static __init int test_ringbuffer(void)
if (total_lost)
pr_info(" With dropped events, record len and size may not match\n"
" alloced and written from above\n");
- if (!total_lost) {
+ else {
if (RB_WARN_ON(buffer, total_len != total_alloc ||
total_size != total_written))
break;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ring-buffer: simplify if-if to if-else
2022-04-24 9:34 [PATCH] ring-buffer: simplify if-if to if-else Wan Jiabing
@ 2022-04-24 16:12 ` Joe Perches
2022-04-25 15:24 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2022-04-24 16:12 UTC (permalink / raw)
To: Wan Jiabing, Steven Rostedt, Ingo Molnar, linux-kernel; +Cc: kael_w
On Sun, 2022-04-24 at 17:34 +0800, Wan Jiabing wrote:
> Use if and else instead of if(A) and if (!A).
[]
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
[]
> @@ -6014,7 +6014,7 @@ static __init int test_ringbuffer(void)
> if (total_lost)
> pr_info(" With dropped events, record len and size may not match\n"
> " alloced and written from above\n");
> - if (!total_lost) {
> + else {
please run your proposed patches through checkpatch.
(add braces to the if block)
additionally:
the pr_info on two lines seems pointless and it's probably nicer
just written on a single line.
pr_info(" With dropped events, recorded len and size may not match alloced and written from above\n");
> if (RB_WARN_ON(buffer, total_len != total_alloc ||
> total_size != total_written))
> break;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ring-buffer: simplify if-if to if-else
2022-04-24 16:12 ` Joe Perches
@ 2022-04-25 15:24 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2022-04-25 15:24 UTC (permalink / raw)
To: Joe Perches; +Cc: Wan Jiabing, Ingo Molnar, linux-kernel, kael_w
On Sun, 24 Apr 2022 09:12:45 -0700
Joe Perches <joe@perches.com> wrote:
> the pr_info on two lines seems pointless and it's probably nicer
> just written on a single line.
>
> pr_info(" With dropped events, recorded len and size may not match alloced and written from above\n");
Which makes it 86 characters long, and this test is run on my machine that
has a 80 character console.
Please keep the original line breakage.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-25 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 9:34 [PATCH] ring-buffer: simplify if-if to if-else Wan Jiabing
2022-04-24 16:12 ` Joe Perches
2022-04-25 15:24 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.