From b2460c2aee9a757bf0b438dde5b5ee71afc54e44 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Wed, 23 Apr 2025 10:41:31 +0100 Subject: [PATCH] btrfs: remove unnecessary NULL checks before freeing extent state When manipulating extent bits for an io tree range, we have this pattern: if (prealloc) btrfs_free_extent_state(prealloc); but this is not needed nowadays since btrfs_free_extent_state() ignores a NULL pointer argument, following the common pattern of kernel and btrfs freeing functions, as well as libc and other user space libraries. So remove the NULL checks, reducing source code and object size. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/extent-io-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index dd36322fbf6b..9266bb39c619 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -761,8 +761,7 @@ search_again: out: spin_unlock(&tree->lock); - if (prealloc) - btrfs_free_extent_state(prealloc); + btrfs_free_extent_state(prealloc); return ret; @@ -1285,8 +1284,7 @@ search_again: out: spin_unlock(&tree->lock); - if (prealloc) - btrfs_free_extent_state(prealloc); + btrfs_free_extent_state(prealloc); return ret; @@ -1525,8 +1523,7 @@ search_again: out: spin_unlock(&tree->lock); - if (prealloc) - btrfs_free_extent_state(prealloc); + btrfs_free_extent_state(prealloc); return ret; } -- 2.50.1