gfs2: Remove unneeded return variable
diff mbox series

Message ID 1614676526-102967-1-git-send-email-yang.lee@linux.alibaba.com
State New, archived
Headers show
Series
  • gfs2: Remove unneeded return variable
Related show

Commit Message

Yang Li March 2, 2021, 9:15 a.m. UTC
This patch removes unneeded return variables, using only
'0' instead.
It fixes the following warning detected by coccinelle:
./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on
line 628

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 fs/gfs2/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Bob Peterson March 3, 2021, 3:40 p.m. UTC | #1
----- Original Message -----
> This patch removes unneeded return variables, using only
> '0' instead.
> It fixes the following warning detected by coccinelle:
> ./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on
> line 628
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  fs/gfs2/super.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index 861ed5f..fe2dae4 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -589,7 +589,6 @@ static void gfs2_dirty_inode(struct inode *inode, int
> flags)
>  
>  int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
>  {
> -	int error = 0;
>  	int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
>  
>  	gfs2_flush_delete_work(sdp);
> @@ -625,7 +624,7 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
>  	if (!log_write_allowed)
>  		sdp->sd_vfs->s_flags |= SB_RDONLY;
>  
> -	return error;
> +	return 0;
>  }
>  
>  /**
> --
> 1.8.3.1

Hi Yang,

Thanks for submitting your patch. I like it. However, since gfs2_make_fs_ro
always returns 0, we should also be able to make it a void function instead
of int, and change its callers to not act on any return code.

Regards,

Bob Peterson
Red Hat File Systems

Patch
diff mbox series

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 861ed5f..fe2dae4 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -589,7 +589,6 @@  static void gfs2_dirty_inode(struct inode *inode, int flags)
 
 int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
 {
-	int error = 0;
 	int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
 
 	gfs2_flush_delete_work(sdp);
@@ -625,7 +624,7 @@  int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
 	if (!log_write_allowed)
 		sdp->sd_vfs->s_flags |= SB_RDONLY;
 
-	return error;
+	return 0;
 }
 
 /**