2022-01-22 00:44:23

by CGEL

[permalink] [raw]
Subject: [PATCH] block: fix boolreturn.cocci warning

From: Changcheng Deng <[email protected]>

./block/bio.c: 1057: 9-10: WARNING:
return of 0/1 in function 'bio_add_folio' with return type bool

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

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Changcheng Deng <[email protected]>
---
block/bio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/bio.c b/block/bio.c
index 4312a8085396..108b11106c8d 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1054,7 +1054,7 @@ bool bio_add_folio(struct bio *bio, struct folio *folio, size_t len,
size_t off)
{
if (len > UINT_MAX || off > UINT_MAX)
- return 0;
+ return false;
return bio_add_page(bio, &folio->page, len, off) > 0;
}

--
2.25.1