diff mbox series

[4/8] btrfs: fix uninit warning in btrfs_update_block_group

Message ID 87302b559838af285024d47b3b738ef36ad0ebe4.1671221596.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Fixup uninitialized warnings and enable extra checks | expand

Commit Message

Josef Bacik Dec. 16, 2022, 8:15 p.m. UTC
reclaim isn't set in the alloc case, however we only care about reclaim
in the !alloc case.  This isn't an actual problem, however
-Wmaybe-uninitialized will complain, so initialize reclaim to quiet the
compiler.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/block-group.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Qu Wenruo Dec. 17, 2022, 12:16 a.m. UTC | #1
On 2022/12/17 04:15, Josef Bacik wrote:
> reclaim isn't set in the alloc case, however we only care about reclaim
> in the !alloc case.  This isn't an actual problem, however
> -Wmaybe-uninitialized will complain, so initialize reclaim to quiet the
> compiler.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   fs/btrfs/block-group.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index 708d843daa72..e90800388a41 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -3330,7 +3330,7 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
>   	spin_unlock(&info->delalloc_root_lock);
>   
>   	while (total) {
> -		bool reclaim;
> +		bool reclaim = false;
>   
>   		cache = btrfs_lookup_block_group(info, bytenr);
>   		if (!cache) {
Johannes Thumshirn Dec. 19, 2022, 7:56 a.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 708d843daa72..e90800388a41 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -3330,7 +3330,7 @@  int btrfs_update_block_group(struct btrfs_trans_handle *trans,
 	spin_unlock(&info->delalloc_root_lock);
 
 	while (total) {
-		bool reclaim;
+		bool reclaim = false;
 
 		cache = btrfs_lookup_block_group(info, bytenr);
 		if (!cache) {