Skip to contentSkip to conversation

locking/rtmutex: Return true/false (not 1/0) from bool functions

PATCH New Haowen Bai 1 participant 1 message Mar 1, 2022 Locking primitives

lore
Share & tools
lore

Haowen Bai

author
#0 lore raw

PATCH 1/1 locking/rtmutex: Return true/false (not 1/0) from bool functions

Return boolean values ("true" or "false") instead of 1 or 0 from bool functions. This fixes the following warnings from coccicheck:

kernel/locking/rtmutex.c:375:9-10: WARNING: return of 0/1 in function '__waiter_less' with return type bool

---
 kernel/locking/rtmutex.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/locking/rtmutex.c +5 -5
index 8555c4e..29db06a 100644
@@ -372,24 +372,24 @@ static __always_inline bool __waiter_less(struct rb_node *a, const struct rb_nod
 	struct rt_mutex_waiter *bw = __node_2_waiter(b);
 
 	if (rt_mutex_waiter_less(aw, bw))
-		return 1;
+		return true;
 
 	if (!build_ww_mutex())
-		return 0;
+		return false;
 
 	if (rt_mutex_waiter_less(bw, aw))
-		return 0;
+		return false;
 
 	/* NOTE: relies on waiter->ww_ctx being set before insertion */
 	if (aw->ww_ctx) {
 		if (!bw->ww_ctx)
-			return 1;
+			return true;
 
 		return (signed long)(aw->ww_ctx->stamp -
 				     bw->ww_ctx->stamp) < 0;
 	}
 
-	return 0;
+	return false;
 }
 
 static __always_inline void
Signature · 1 line
2.7.4