[PATCH] utils: simplify bool returns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Found with readability-simplify-boolean-expr

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

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)
-- 
2.25.2




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux