ring-buffer: simplify if-if to if-else
Subsystems (2)
PATCH 1/1 ring-buffer: simplify if-if to if-else
Use if and else instead of if(A) and if (!A).
Signed-off-by Wan Jiabing <[email protected]>
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -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 ;
Signature · 1 line
2.35.1
Quoted 1 line · Wan Jiabing
Use if and else instead of if(A) and if (!A).
[]
kernel/trace/ring_buffer.c
Quoted 1 line
kernel/trace/ring_buffer.c +0
-0
[]
kernel/trace/ring_buffer.c static __init int test_ringbuffer(void) · line 6017
Quoted 6 lines
kernel/trace/ring_buffer.c +1
-1@@ -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");Quoted 3 lines
kernel/trace/ring_buffer.c +0
-0if (RB_WARN_ON (buffer, total_len != total_alloc || total_size != total_written))break ;
Steven Rostedt
maintainerQuoted 4 lines · On Sun, 24 Apr 2022 09:12:45 -0700 Joe Perches <[email protected]> wrote:
the
pr_infoon 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