LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH linux-next] kernel:rtmutex: fix boolreturn.cocci warnings
@ 2021-08-24  6:27 CGEL
  0 siblings, 0 replies; only message in thread
From: CGEL @ 2021-08-24  6:27 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, Will Deacon, Waiman Long, Boqun Feng, linux-kernel,
	Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

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

Return statements in functions returning bool should use true/false
instead of 1/0.

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 kernel/locking/rtmutex.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 8aaa352..f904f25 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -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
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-24  6:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:27 [PATCH linux-next] kernel:rtmutex: fix boolreturn.cocci warnings CGEL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).