diff mbox series

[3.16-stable,08/14] gfs2: remove IS_ERR_VALUE abuse

Message ID 20170509100502.1358298-9-arnd@arndb.de
State New
Headers show
Series [3.16-stable,01/14] staging: r8192ee: prorperly format warning message | expand

Commit Message

Arnd Bergmann May 9, 2017, 10:04 a.m. UTC
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>

---
 fs/gfs2/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.0

Comments

Ben Hutchings Nov. 6, 2017, 7:46 p.m. UTC | #1
On Tue, 2017-05-09 at 12:04 +0200, Arnd Bergmann wrote:
> 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")


In fact, it reverts it completely.  So I've dropped both of these.

Ben.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  fs/gfs2/dir.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c

> index 6810c8772eb1..f3508f4583d5 100644

> --- a/fs/gfs2/dir.c

> +++ b/fs/gfs2/dir.c

> @@ -767,7 +767,7 @@ static int get_first_leaf(struct gfs2_inode *dip, u32 index,

>  	int error;

>  

>  	error = get_leaf_nr(dip, index, &leaf_no);

> -	if (!IS_ERR_VALUE(error))

> +	if (!error)

>  		error = get_leaf(dip, leaf_no, bh_out);

>  

>  	return error;

> @@ -983,7 +983,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)

>  

>  	index = name->hash >> (32 - dip->i_depth);

>  	error = get_leaf_nr(dip, index, &leaf_no);

> -	if (IS_ERR_VALUE(error))

> +	if (error)

>  		return error;

>  

>  	/*  Get the old leaf block  */

-- 
Ben Hutchings
It is a miracle that curiosity survives formal education. - Albert
Einstein
diff mbox series

Patch

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 6810c8772eb1..f3508f4583d5 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -767,7 +767,7 @@  static int get_first_leaf(struct gfs2_inode *dip, u32 index,
 	int error;
 
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (!IS_ERR_VALUE(error))
+	if (!error)
 		error = get_leaf(dip, leaf_no, bh_out);
 
 	return error;
@@ -983,7 +983,7 @@  static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 
 	index = name->hash >> (32 - dip->i_depth);
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (IS_ERR_VALUE(error))
+	if (error)
 		return error;
 
 	/*  Get the old leaf block  */