diff mbox series

utils: simplify bool returns

Message ID 20200417211740.4840-1-rosenp@gmail.com (mailing list archive)
State New, archived
Headers show
Series utils: simplify bool returns | expand

Commit Message

Rosen Penev April 17, 2020, 9:17 p.m. UTC
Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 utils/cec-compliance/cec-test-audio.cpp | 8 ++------
 utils/cec-follower/cec-processing.cpp   | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/utils/cec-compliance/cec-test-audio.cpp b/utils/cec-compliance/cec-test-audio.cpp
index 576d59c6..d422a7da 100644
--- a/utils/cec-compliance/cec-test-audio.cpp
+++ b/utils/cec-compliance/cec-test-audio.cpp
@@ -113,9 +113,7 @@  static bool pa_are_adjacent(__u16 pa1, __u16 pa2)
 		return false;
 	if ((pa1 & trail_mask) || (pa2 & trail_mask))
 		return false;
-	if (!((pa1 & ~mask) && (pa2 & ~mask)))
-		return true;
-	return false;
+	return !((pa1 & ~mask) && (pa2 & ~mask));
 }
 
 static bool pa_is_upstream_from(__u16 pa1, __u16 pa2)
@@ -124,9 +122,7 @@  static bool pa_is_upstream_from(__u16 pa1, __u16 pa2)
 
 	if (pa1 == CEC_PHYS_ADDR_INVALID || pa2 == CEC_PHYS_ADDR_INVALID)
 		return false;
-	if (!(pa1 & ~mask) && (pa2 & ~mask))
-		return true;
-	return false;
+	return !(pa1 & ~mask) && (pa2 & ~mask);
 }
 
 static int arc_initiate_tx(struct node *node, unsigned me, unsigned la, bool interactive)
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 75000b73..e4056c55 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -214,9 +214,7 @@  static bool pa_are_adjacent(__u16 pa1, __u16 pa2)
 		return false;
 	if ((pa1 & trail_mask) || (pa2 & trail_mask))
 		return false;
-	if (!((pa1 & ~mask) && (pa2 & ~mask)))
-		return true;
-	return false;
+	return !((pa1 & ~mask) && (pa2 & ~mask));
 }
 
 static bool pa_is_upstream_from(__u16 pa1, __u16 pa2)
@@ -225,9 +223,7 @@  static bool pa_is_upstream_from(__u16 pa1, __u16 pa2)
 
 	if (pa1 == CEC_PHYS_ADDR_INVALID || pa2 == CEC_PHYS_ADDR_INVALID)
 		return false;
-	if (!(pa1 & ~mask) && (pa2 & ~mask))
-		return true;
-	return false;
+	return !(pa1 & ~mask) && (pa2 & ~mask);
 }
 
 static __u8 current_power_state(struct node *node)