diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-05-05 22:46:28 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-11-11 16:33:43 +0300 |
commit | ebb4ccde90e52413b5a11e624e176825f4f1fe57 (patch) | |
tree | ec02d0e95bcc86f16ec4a1aa262ec848d9c52fd3 | |
parent | f1e8b20371007c937ea213ce67a2c1424d3640b1 (diff) | |
download | linux-ebb4ccde90e52413b5a11e624e176825f4f1fe57.tar.xz |
gfs2: remove IS_ERR_VALUE abuse
Picked from commit 287980e49ffc0f6d911601e7e352a812ed27768e ("remove lots
of IS_ERR_VALUE abuses") upstream.
The original fix that was backported to 3.18 already addressed the warning
in some configurations, but not in others, leaving us with the same output:
../fs/gfs2/dir.c: In function 'get_first_leaf':
../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
error = get_leaf(dip, leaf_no, bh_out);
^
../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20':
../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
This takes the approach that we took in later versions in mainline,
but does not backport the entire patch, as that would be too large
for stable and IIRC caused regressions in other drivers.
Fixes: 9d46d31e9aea ("gfs2: avoid uninitialized variable warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/gfs2/dir.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 5d4261ff5d23..f3508f4583d5 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -749,12 +749,15 @@ static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out) { __be64 *hash; + int error; hash = gfs2_dir_get_hash_table(dip); - if (IS_ERR(hash)) - return PTR_ERR(hash); - *leaf_out = be64_to_cpu(*(hash + index)); - return 0; + error = PTR_ERR_OR_ZERO(hash); + + if (!error) + *leaf_out = be64_to_cpu(*(hash + index)); + + return error; } static int get_first_leaf(struct gfs2_inode *dip, u32 index, |