Skip to contentSkip to conversation

ring-buffer: simplify if-if to if-else

PATCH Superseded Wan Jiabing 1 participant 1 message Apr 25, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ring-buffer: simplify if-if to if-else

Use if and else instead of if(A) and if (!A).

---
Change log:
v2:
- add braces to the if block and make pr_info nicer.

---
 kernel/trace/ring_buffer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/trace/ring_buffer.c +3 -4
index 05dfc7a12d3d..2860db50413f 100644
@@ -6011,10 +6011,9 @@ static __init int test_ringbuffer(void)
 		pr_info("        total events:   %ld\n", total_lost + total_read);
 		pr_info("  recorded len bytes:   %ld\n", total_len);
 		pr_info(" recorded size bytes:   %ld\n", total_size);
-		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) {
+		if (total_lost) {
+			pr_info(" With dropped events, record len and size may not match alloced and written from above\n");
+		} else {
 			if (RB_WARN_ON(buffer, total_len != total_alloc ||
 				       total_size != total_written))
 				break;
Signature · 1 line
2.35.1