* [PATCH] block: fix boolreturn.cocci warning
@ 2022-01-21 9:47 cgel.zte
0 siblings, 0 replies; 5+ messages in thread
From: cgel.zte @ 2022-01-21 9:47 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel, Changcheng Deng, Zeal Robot
From: Changcheng Deng <deng.changcheng@zte.com.cn>
./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 <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] block: fix boolreturn.cocci warning
2022-01-28 4:34 Jiapeng Chong
2022-01-28 7:43 ` Christoph Hellwig
2022-01-28 9:10 ` Chaitanya Kulkarni
@ 2022-01-28 13:38 ` Jens Axboe
2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-01-28 13:38 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: linux-kernel, Abaci Robot, linux-block
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,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] block: fix boolreturn.cocci warning
2022-01-28 4:34 Jiapeng Chong
2022-01-28 7:43 ` Christoph Hellwig
@ 2022-01-28 9:10 ` Chaitanya Kulkarni
2022-01-28 13:38 ` Jens Axboe
2 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2022-01-28 9:10 UTC (permalink / raw)
To: Jiapeng Chong, axboe; +Cc: linux-block, linux-kernel, Abaci Robot
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] block: fix boolreturn.cocci warning
2022-01-28 4:34 Jiapeng Chong
@ 2022-01-28 7:43 ` Christoph Hellwig
2022-01-28 9:10 ` Chaitanya Kulkarni
2022-01-28 13:38 ` Jens Axboe
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-01-28 7:43 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: axboe, linux-block, linux-kernel, Abaci Robot
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] block: fix boolreturn.cocci warning
@ 2022-01-28 4:34 Jiapeng Chong
2022-01-28 7:43 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jiapeng Chong @ 2022-01-28 4:34 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel, Jiapeng Chong, Abaci Robot
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(-)
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;
}
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-28 13:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 9:47 [PATCH] block: fix boolreturn.cocci warning cgel.zte
2022-01-28 4:34 Jiapeng Chong
2022-01-28 7:43 ` Christoph Hellwig
2022-01-28 9:10 ` Chaitanya Kulkarni
2022-01-28 13:38 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.