lkml.org 
[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] locking/rwbase: fix boolreturn.cocci warning
Date
From: Changcheng Deng <deng.changcheng@zte.com.cn>

./kernel/locking/rwbase_rt.c: 226: 9-10: WARNING: return of 0/1 in
function '__rwbase_write_trylock' with return type bool

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

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
kernel/locking/rwbase_rt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/locking/rwbase_rt.c b/kernel/locking/rwbase_rt.c
index 6fd3162e4098..e3dd458ee0c9 100644
--- a/kernel/locking/rwbase_rt.c
+++ b/kernel/locking/rwbase_rt.c
@@ -223,10 +223,10 @@ static inline bool __rwbase_write_trylock(struct rwbase_rt *rwb)
*/
if (!atomic_read_acquire(&rwb->readers)) {
atomic_set(&rwb->readers, WRITER_BIAS);
- return 1;
+ return true;
}

- return 0;
+ return false;
}

static int __sched rwbase_write_lock(struct rwbase_rt *rwb,
--
2.25.1
\
 
 \ /
  Last update: 2021-10-20 10:44    [W:0.032 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site