Skip to contentSkip to conversation

block: fix boolreturn.cocci warning

PATCH Applied Jiapeng Chong 4 participants 4 messages Jan 28, 2022 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: fix boolreturn.cocci warning

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

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

---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio.c +1 -1
index 03cefe81950f..2e19ca600fcd 100644
@@ -1078,7 +1078,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;
 }
 
Signature · 1 line
2.20.1.7.g153144c
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jiapeng Chong
Quoted 6 lines · Jiapeng Chong

External email: Use caution opening links or attachments

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

Quoted 6 lines

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

---

Good catch, looks good.

maintainer Applied
#3 lore raw
In reply to Jiapeng Chong
Quoted 8 lines · Jiapeng Chong

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

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

[...]

Applied, thanks!

[1/1] block: fix boolreturn.cocci warning

      commit: 7fc6fce0c96ff6db540a974b9b9dc38e241543a5

Best regards,

Signature · 1 line
Jens Axboe