btrfs: avoid uninitialized variable warning
authorArnd Bergmann <arnd@arndb.de>
Mon, 22 Feb 2016 21:53:20 +0000 (22:53 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Feb 2016 11:42:46 +0000 (12:42 +0100)
With CONFIG_SMP and CONFIG_PREEMPT both disabled, gcc decides
to partially inline the get_state_failrec() function but cannot
figure out that means the failrec pointer is always valid
if the function returns success, which causes a harmless
warning:

fs/btrfs/extent_io.c: In function 'clean_io_failure':
fs/btrfs/extent_io.c:2131:4: error: 'failrec' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This marks get_state_failrec() and set_state_failrec() both
as 'noinline', which avoids the warning in all cases for me,
and seems less ugly than adding a fake initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 47dc196ae719 ("btrfs: use proper type for failrec in extent_state")
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c

index 96d24d04979768269ae8e7eb1e557993a9368830..b3f7bba91ab1871d405e9b3ace24d04ed1d51da4 100644 (file)
@@ -1842,7 +1842,7 @@ out:
  * set the private field for a given byte offset in the tree.  If there isn't
  * an extent_state there already, this does nothing.
  */
-static int set_state_failrec(struct extent_io_tree *tree, u64 start,
+static noinline int set_state_failrec(struct extent_io_tree *tree, u64 start,
                struct io_failure_record *failrec)
 {
        struct rb_node *node;
@@ -1870,7 +1870,7 @@ out:
        return ret;
 }
 
-static int get_state_failrec(struct extent_io_tree *tree, u64 start,
+static noinline int get_state_failrec(struct extent_io_tree *tree, u64 start,
                struct io_failure_record **failrec)
 {
        struct rb_node *node;
This page took 0.027114 seconds and 5 git commands to generate.