diff mbox series

btrfs: Assign boolean values to a bool variable

Message ID 1614764728-14857-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Assign boolean values to a bool variable | expand

Commit Message

Jiapeng Chong March 3, 2021, 9:45 a.m. UTC
Fix the following coccicheck warnings:

./fs/btrfs/volumes.c:1462:10-11: WARNING: return of 0/1 in function
'dev_extent_hole_check_zoned' with return type bool.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba March 4, 2021, 1:38 p.m. UTC | #1
On Wed, Mar 03, 2021 at 05:45:28PM +0800, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./fs/btrfs/volumes.c:1462:10-11: WARNING: return of 0/1 in function
> 'dev_extent_hole_check_zoned' with return type bool.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Added to misc-next, thanks.
Johannes Thumshirn May 10, 2021, 9:37 a.m. UTC | #2
On 04/03/2021 02:51, Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./fs/btrfs/volumes.c:1462:10-11: WARNING: return of 0/1 in function
> 'dev_extent_hole_check_zoned' with return type bool.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  fs/btrfs/volumes.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index bc3b33e..995920f 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1458,8 +1458,8 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
>  		/* Given hole range was invalid (outside of device) */
>  		if (ret == -ERANGE) {
>  			*hole_start += *hole_size;
> -			*hole_size = 0;
> -			return 1;
> +			*hole_size = false;


Erm, hole_size is u64 and not bool
David Sterba May 10, 2021, 1:38 p.m. UTC | #3
On Mon, May 10, 2021 at 09:37:58AM +0000, Johannes Thumshirn wrote:
> On 04/03/2021 02:51, Jiapeng Chong wrote:
> > Fix the following coccicheck warnings:
> > 
> > ./fs/btrfs/volumes.c:1462:10-11: WARNING: return of 0/1 in function
> > 'dev_extent_hole_check_zoned' with return type bool.
> > 
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > ---
> >  fs/btrfs/volumes.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index bc3b33e..995920f 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -1458,8 +1458,8 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
> >  		/* Given hole range was invalid (outside of device) */
> >  		if (ret == -ERANGE) {
> >  			*hole_start += *hole_size;
> > -			*hole_size = 0;
> > -			return 1;
> > +			*hole_size = false;
> 
> 
> Erm, hole_size is u64 and not bool

Thanks for catching it, I should have spotted that.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index bc3b33e..995920f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1458,8 +1458,8 @@  static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
 		/* Given hole range was invalid (outside of device) */
 		if (ret == -ERANGE) {
 			*hole_start += *hole_size;
-			*hole_size = 0;
-			return 1;
+			*hole_size = false;
+			return true;
 		}
 
 		*hole_start += zone_size;