diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-12-16 15:15:53 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-02-13 17:50:33 +0100 |
commit | ab199013592abb3499b8316a800a39ab61e6719f (patch) | |
tree | 211698eae21e599f1aa9bca922f890641dc24310 /fs/btrfs/send.c | |
parent | 0e47b25cafb29338722f68e8c5a260aaf18ce92c (diff) |
btrfs: fix uninitialized variable warning in get_inode_gen
Anybody that calls get_inode_gen() can have an uninitialized gen if
there's an error. This isn't a big deal because all the users just exit
if they get an error, however it makes -Wmaybe-uninitialized complain,
so fix this up to always initialize the passed in gen, this quiets all
of the uninitialized warnings in send.c.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index d50182b6deec..7817bf8d0c0b 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -956,14 +956,12 @@ out: static int get_inode_gen(struct btrfs_root *root, u64 ino, u64 *gen) { int ret; - struct btrfs_inode_info info; + struct btrfs_inode_info info = { 0 }; - if (!gen) - return -EPERM; + ASSERT(gen); ret = get_inode_info(root, ino, &info); - if (!ret) - *gen = info.gen; + *gen = info.gen; return ret; } |