[Drbd-dev] [PATCH -next] mm/fs: fix boolreturn.cocci warning

Yang Li yang.lee at linux.alibaba.com
Thu Feb 3 04:30:33 CET 2022


Return statement in function returning bool should use true/false
instead of 1/0.

Eliminate the following coccicheck warning:
./drivers/block/drbd/drbd_req.c:912:9-10: WARNING: return of 0/1 in
function 'remote_due_to_read_balancing' with return type bool

Reported-by: Abaci Robot <abaci at linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee at linux.alibaba.com>
---
 drivers/block/drbd/drbd_req.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 2e5fb7e442e3..c8448379bbcd 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -909,7 +909,7 @@ static bool remote_due_to_read_balancing(struct drbd_device *device, sector_t se
 
 	switch (rbm) {
 	case RB_CONGESTED_REMOTE:
-		return 0;
+		return false;
 	case RB_LEAST_PENDING:
 		return atomic_read(&device->local_cnt) >
 			atomic_read(&device->ap_pending_cnt) + atomic_read(&device->rs_pending_cnt);
-- 
2.20.1.7.g153144c



More information about the drbd-dev mailing list