Skip to contentSkip to conversation

btrfs: Assign boolean values to a bool variable

PATCH In review Jiapeng Chong 3 participants 4 messages Mar 3, 2021 – May 10, 2021 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Assign boolean values to a bool variable

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.

---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/volumes.c +2 -2
index bc3b33e..995920f 100644
@@ -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;
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Jiapeng Chong
Quoted 16 lines · Jiapeng Chong

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.

---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/volumes.c +0 -0
index bc3b33e..995920f 100644

fs/btrfs/volumes.c static bool dev_extent_hole_check_zoned(struct btrfs_device *device, · line 1461

Quoted 6 lines
fs/btrfs/volumes.c +1 -2
@@ -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

#3 lore raw
Quoted 12 lines · Johannes Thumshirn
Quoted 11 lines · Jiapeng Chong

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.

---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines

fs/btrfs/volumes.c static bool dev_extent_hole_check_zoned(struct btrfs_device *device, · line 1461

Quoted 11 lines
fs/btrfs/volumes.c +1 -2
index bc3b33e..995920f 100644
@@ -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.