diff options
author | Arnd Bergmann <arnd@arndb.de> | 2019-06-17 13:07:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-31 07:24:28 +0200 |
commit | bee7e7e1f5362075f3b9ff8d468e6496afc715da (patch) | |
tree | 30ce4dec7b52f4a94b095f6d537d67669d7f5527 /fs/btrfs | |
parent | 15718c84f313fe4d936874844cca2b49b535bdf7 (diff) | |
download | linux-stable-bee7e7e1f5362075f3b9ff8d468e6496afc715da.tar.gz linux-stable-bee7e7e1f5362075f3b9ff8d468e6496afc715da.tar.bz2 linux-stable-bee7e7e1f5362075f3b9ff8d468e6496afc715da.zip |
btrfs: shut up bogus -Wmaybe-uninitialized warning
commit 6c64460cdc8be5fa074aa8fe2ae8736d5792bdc5 upstream.
gcc sometimes can't determine whether a variable has been initialized
when both the initialization and the use are conditional:
fs/btrfs/props.c: In function 'inherit_props':
fs/btrfs/props.c:389:4: error: 'num_bytes' may be used uninitialized in this function [-Werror=maybe-uninitialized]
btrfs_block_rsv_release(fs_info, trans->block_rsv,
This code is fine. Unfortunately, I cannot think of a good way to
rephrase it in a way that makes gcc understand this, so I add a bogus
initialization the way one should not.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: David Sterba <dsterba@suse.com>
[ gcc 8 and 9 don't emit the warning ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/props.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index af109c0ba720..e0469816c678 100644 --- a/fs/btrfs/props.c +++ b/fs/btrfs/props.c @@ -337,7 +337,7 @@ static int inherit_props(struct btrfs_trans_handle *trans, for (i = 0; i < ARRAY_SIZE(prop_handlers); i++) { const struct prop_handler *h = &prop_handlers[i]; const char *value; - u64 num_bytes; + u64 num_bytes = 0; if (!h->inheritable) continue; |