Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335126 > unrolled thread

[PATCH] btrfs: fix build warning

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2016-02-16 09:10 +0100
Last post2016-02-16 09:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] btrfs: fix build warning Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-16 09:10 +0100

#1335126 — [PATCH] btrfs: fix build warning

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-02-16 09:10 +0100
Subject[PATCH] btrfs: fix build warning
Message-ID<r2IRQ-5aD-19@gated-at.bofh.it>
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>
---
 fs/btrfs/extent-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e2287c7..f24e4c3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7018,7 +7018,7 @@ btrfs_lock_cluster(struct btrfs_block_group_cache *block_group,
 		   struct btrfs_free_cluster *cluster,
 		   int delalloc)
 {
-	struct btrfs_block_group_cache *used_bg;
+	struct btrfs_block_group_cache *used_bg = NULL;
 	bool locked = false;
 again:
 	spin_lock(&cluster->refill_lock);
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web