Commit f827ba9a authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David Sterba

btrfs: avoid uninitialized variable warning

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: default avatarArnd Bergmann <arnd@arndb.de>
Fixes: 47dc196a ("btrfs: use proper type for failrec in extent_state")
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 5598e900
...@@ -1842,7 +1842,7 @@ u64 count_range_bits(struct extent_io_tree *tree, ...@@ -1842,7 +1842,7 @@ u64 count_range_bits(struct extent_io_tree *tree,
* set the private field for a given byte offset in the tree. If there isn't * set the private field for a given byte offset in the tree. If there isn't
* an extent_state there already, this does nothing. * 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 io_failure_record *failrec)
{ {
struct rb_node *node; struct rb_node *node;
...@@ -1870,7 +1870,7 @@ static int set_state_failrec(struct extent_io_tree *tree, u64 start, ...@@ -1870,7 +1870,7 @@ static int set_state_failrec(struct extent_io_tree *tree, u64 start,
return ret; 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 io_failure_record **failrec)
{ {
struct rb_node *node; struct rb_node *node;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment