diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2025-10-24 12:21:42 +0200 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2025-11-24 22:34:51 +0100 |
| commit | 7ab5d01d58a766807e137cbe8c90cb2e591e2f7d (patch) | |
| tree | 37355460910ff0211e6e573698e10b5cb2693df9 /fs/btrfs/reflink.c | |
| parent | d00cbce0a7d5de5fc31bf60abd59b44d36806b6e (diff) | |
btrfs: apply the AUTO_K(V)FREE macros throughout the code
Apply the AUTO_KFREE and AUTO_KVFREE macros wherever it makes
sense. Since this macro is expected to improve code readability, it has
been avoided in places where the lifetime of objects wasn't easy to
follow and a cleanup attribute would've made things worse; or when the
cleanup section of a function involved many other things and thus there
was no readability impact anyways. This change has also not been applied
in extremely short functions where readability was clearly not an issue.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/reflink.c')
| -rw-r--r-- | fs/btrfs/reflink.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c index 1bbe3bb7e1bb..775a32a7953a 100644 --- a/fs/btrfs/reflink.c +++ b/fs/btrfs/reflink.c @@ -343,7 +343,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode, BTRFS_PATH_AUTO_FREE(path); struct extent_buffer *leaf; struct btrfs_trans_handle *trans; - char *buf = NULL; + char AUTO_KVFREE(buf); struct btrfs_key key; u32 nritems; int slot; @@ -358,10 +358,8 @@ static int btrfs_clone(struct inode *src, struct inode *inode, return ret; path = btrfs_alloc_path(); - if (!path) { - kvfree(buf); + if (!path) return ret; - } path->reada = READA_FORWARD; /* Clone data */ @@ -611,7 +609,6 @@ process_slot: } out: - kvfree(buf); clear_bit(BTRFS_INODE_NO_DELALLOC_FLUSH, &BTRFS_I(inode)->runtime_flags); return ret; |