diff mbox series

[2/7] btrfs: replace BUG_ON(level == 0) with ASSERT(level)

Message ID c32e735843f82e6348877672218abe529d5ce585.1675787102.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Error handling fixes | expand

Commit Message

Josef Bacik Feb. 7, 2023, 4:57 p.m. UTC
In btrfs_read_node_slot() we have a BUG_ON() that can be converted to an
ASSERT().

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/ctree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Thumshirn Feb. 8, 2023, 9:39 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 118440857f33..484d750df4c6 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -964,7 +964,7 @@  struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
 	if (slot < 0 || slot >= btrfs_header_nritems(parent))
 		return ERR_PTR(-ENOENT);
 
-	BUG_ON(level == 0);
+	ASSERT(level);
 
 	check.level = level - 1;
 	check.transid = btrfs_node_ptr_generation(parent, slot);