Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452890 > unrolled thread

[PATCH 6/6] fs: befs: remove ret variable

Started bySalah Triki <salah.triki@gmail.com>
First post2016-07-31 22:40 +0200
Last post2016-08-01 16:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] fs: befs: remove ret variable Salah Triki <salah.triki@gmail.com> - 2016-07-31 22:40 +0200
    Re: [PATCH 6/6] fs: befs: remove ret variable Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-08-01 16:30 +0200

#1452890 — [PATCH 6/6] fs: befs: remove ret variable

FromSalah Triki <salah.triki@gmail.com>
Date2016-07-31 22:40 +0200
Subject[PATCH 6/6] fs: befs: remove ret variable
Message-ID<s15GF-4Uk-19@gated-at.bofh.it>
ret is initialized to -EIO and is never modified, so remove ret and use
-EIO directly.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 fs/befs/linuxvfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 2b68c81..c57f831 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -300,7 +300,6 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
 	struct befs_sb_info *befs_sb = BEFS_SB(sb);
 	struct befs_inode_info *befs_ino;
 	struct inode *inode;
-	long ret = -EIO;
 
 	befs_debug(sb, "---> %s inode = %lu", __func__, ino);
 
@@ -422,7 +421,7 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
       unacquire_none:
 	iget_failed(inode);
 	befs_debug(sb, "<--- %s - Bad inode", __func__);
-	return ERR_PTR(ret);
+	return ERR_PTR(-EIO);
 }
 
 /* Initialize the inode cache. Called at fs setup.
-- 
1.9.1

[toc] | [next] | [standalone]


#1453244

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-08-01 16:30 +0200
Message-ID<s1moa-7tr-15@gated-at.bofh.it>
In reply to#1452890
On 31/07/16 21:34, Salah Triki wrote:
> ret is initialized to -EIO and is never modified, so remove ret and use
> -EIO directly.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  fs/befs/linuxvfs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
> index 2b68c81..c57f831 100644
> --- a/fs/befs/linuxvfs.c
> +++ b/fs/befs/linuxvfs.c
> @@ -300,7 +300,6 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
>  	struct befs_sb_info *befs_sb = BEFS_SB(sb);
>  	struct befs_inode_info *befs_ino;
>  	struct inode *inode;
> -	long ret = -EIO;
>  
>  	befs_debug(sb, "---> %s inode = %lu", __func__, ino);
>  
> @@ -422,7 +421,7 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
>        unacquire_none:
>  	iget_failed(inode);
>  	befs_debug(sb, "<--- %s - Bad inode", __func__);
> -	return ERR_PTR(ret);
> +	return ERR_PTR(-EIO);
>  }
>  
>  /* Initialize the inode cache. Called at fs setup.
> 

Hi Salah,

This one is a nice catch, since your patch also makes the code more readable.
No need to check the value of ret when you read that return ERR_PTR() anymore.

This has been this way since the introduction of ret in commit
96eb5419412fbc7f39fa45d987034c5d0e6e1202.
No need to add a "Fixes" tag in the commit message because that commit was 8
years ago.

Acked-by: Luis de Bethencourt <luisbg@osg.samsung.com>

Thanks :)
Luis

Pushed to the befs-next branch:
https://github.com/luisbg/linux-befs/tree/befs-next

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web