diff mbox series

block: fix boolreturn.cocci warning

Message ID 20220128043454.68927-1-jiapeng.chong@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series block: fix boolreturn.cocci warning | expand

Commit Message

Jiapeng Chong Jan. 28, 2022, 4:34 a.m. UTC
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.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 block/bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Jan. 28, 2022, 7:43 a.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Chaitanya Kulkarni Jan. 28, 2022, 9:10 a.m. UTC | #2
On 1/27/22 8:34 PM, Jiapeng Chong wrote:
> External email: Use caution opening links or attachments
> 
> 
> 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.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---

Good catch, looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Jens Axboe Jan. 28, 2022, 1:38 p.m. UTC | #3
On Fri, 28 Jan 2022 12:34:54 +0800, Jiapeng Chong wrote:
> 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,
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 03cefe81950f..2e19ca600fcd 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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;
 }