diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2025-10-24 13:21:41 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-13 19:20:29 +0300 |
| commit | acefb51f406c28f0b0230cd3bfeb83bcdf902b56 (patch) | |
| tree | eadc542d7b059d6d1e560929afbdd8da586964d1 /fs | |
| parent | 531c755f25076b5e46275dd2805a9e7ec6a6b056 (diff) | |
| download | linux-acefb51f406c28f0b0230cd3bfeb83bcdf902b56.tar.xz | |
btrfs: define the AUTO_KFREE/AUTO_KVFREE helper macros
[ Upstream commit d00cbce0a7d5de5fc31bf60abd59b44d36806b6e ]
These are two simple macros which ensure that a pointer is initialized
to NULL and with the proper cleanup attribute for it.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 52ee9965d09b ("btrfs: zoned: fixup last alloc pointer after extent removal for RAID0/10")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/btrfs/misc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/misc.h b/fs/btrfs/misc.h index 0d599fd847c9..1212674d7a1b 100644 --- a/fs/btrfs/misc.h +++ b/fs/btrfs/misc.h @@ -11,6 +11,13 @@ #include <linux/rbtree.h> /* + * Convenience macros to define a pointer with the __free(kfree) and + * __free(kvfree) cleanup attributes and initialized to NULL. + */ +#define AUTO_KFREE(name) *name __free(kfree) = NULL +#define AUTO_KVFREE(name) *name __free(kvfree) = NULL + +/* * Enumerate bits using enum autoincrement. Define the @name as the n-th bit. */ #define ENUM_BIT(name) \ |
