Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: fix build warning

We were getting build warning about:
fs/btrfs/extent-tree.c:7021:34: warning: ‘used_bg’ may be used
uninitialized in this function

It is not a valid warning as used_bg is never used uninitilized since
locked is initially false so we can never be in the section where
'used_bg' is used. But gcc is not able to understand that and we can
initialize it while declaring to silence the warning.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Sudip Mukherjee and committed by
David Sterba
89771cc9 47dc196a

+1 -1
+1 -1
fs/btrfs/extent-tree.c
··· 7018 7018 struct btrfs_free_cluster *cluster, 7019 7019 int delalloc) 7020 7020 { 7021 - struct btrfs_block_group_cache *used_bg; 7021 + struct btrfs_block_group_cache *used_bg = NULL; 7022 7022 bool locked = false; 7023 7023 again: 7024 7024 spin_lock(&cluster->refill_lock);