linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning in Linus' tree
@ 2012-01-18 23:09 Stephen Rothwell
  2012-01-19 10:24 ` [PATCH] Btrfs: fix uninit warning in backref.c Jan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2012-01-18 23:09 UTC (permalink / raw)
  To: Chris Mason
  Cc: linux-next, linux-kernel, Jan Schmidt, Arne Jansen, Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

Hi Linus,

Building Linus' tree, today's linux-next build (powerpc_ppc64_defconfig)
produced these warnings:

fs/btrfs/backref.c: In function 'find_parent_nodes':
fs/btrfs/backref.c:482:3: warning: 'ret' may be used uninitialized in this function [-Wuninitialized]
fs/btrfs/backref.c:395:6: note: 'ret' was declared here
fs/btrfs/backref.c:381:3: warning: 'ret' may be used uninitialized in this function [-Wuninitialized]
fs/btrfs/backref.c:300:6: note: 'ret' was declared here

and indeed, there is a path through to a BUG_ON(ret) that does not set
"ret".  Introduced by commit 8da6d5815c59 ("Btrfs: added
btrfs_find_all_roots()").

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Btrfs: fix uninit warning in backref.c
  2012-01-18 23:09 linux-next: build warning in Linus' tree Stephen Rothwell
@ 2012-01-19 10:24 ` Jan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Schmidt @ 2012-01-19 10:24 UTC (permalink / raw)
  To: sfr, chris.mason, linux-btrfs
  Cc: linux-next, linux-kernel, sensille, torvalds

Added initialization with the declaration of ret. It isn't set later on the
switch-default branch (which should never be taken).

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
 fs/btrfs/backref.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index b9a8432..633c701 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -297,7 +297,7 @@ static int __add_delayed_refs(struct btrfs_delayed_ref_head *head, u64 seq,
 	struct btrfs_delayed_extent_op *extent_op = head->extent_op;
 	struct rb_node *n = &head->node.rb_node;
 	int sgn;
-	int ret;
+	int ret = 0;
 
 	if (extent_op && extent_op->update_key)
 		btrfs_disk_key_to_cpu(info_key, &extent_op->key);
@@ -392,7 +392,7 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
 			     struct btrfs_key *info_key, int *info_level,
 			     struct list_head *prefs)
 {
-	int ret;
+	int ret = 0;
 	int slot;
 	struct extent_buffer *leaf;
 	struct btrfs_key key;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-19 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18 23:09 linux-next: build warning in Linus' tree Stephen Rothwell
2012-01-19 10:24 ` [PATCH] Btrfs: fix uninit warning in backref.c Jan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).