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


Groups > linux.kernel > #1451362

Re: [RESEND PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr

From Luis de Bethencourt <luisbg@osg.samsung.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr
Date 2016-07-27 17:40 +0200
Message-ID <rZz6a-1cX-17@gated-at.bofh.it> (permalink)
References <rZny1-2o5-7@gated-at.bofh.it> <rZny1-2o5-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 27/07/16 04:11, Salah Triki wrote:
> Since goto statement merely returns NULL, replace it with return
> statement.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  fs/befs/io.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/befs/io.c b/fs/befs/io.c
> index 4223b77..af631a6 100644
> --- a/fs/befs/io.c
> +++ b/fs/befs/io.c
> @@ -37,7 +37,7 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
>  	if (iaddr.allocation_group > befs_sb->num_ags) {
>  		befs_error(sb, "BEFS: Invalid allocation group %u, max is %u",
>  			   iaddr.allocation_group, befs_sb->num_ags);
> -		goto error;
> +		return NULL;
>  	}
>  
>  	block = iaddr2blockno(sb, &iaddr);
> @@ -49,13 +49,9 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
>  	if (bh == NULL) {
>  		befs_error(sb, "Failed to read block %lu",
>  			   (unsigned long)block);
> -		goto error;
> +		return NULL;
>  	}
>  
>  	befs_debug(sb, "<--- %s", __func__);
>  	return bh;
> -
> -      error:
> -	befs_debug(sb, "<--- %s ERROR", __func__);
> -	return NULL;
>  }
> 

Hi Salah,

The goto statement also calls the debug function. I  know it doesn't look pretty
to have "debug; return; label; debug; return;", but I find these debug calls at
the start and end of functions very useful when reading dmesg to see that all
functions entered and exited correctly.

I prefer not removing that befs_debug(... ERROR ...);
Unless anybody else agree this is a good patch.

Thanks,
Luis

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH 1/4] fs: befs: Remove redundant validation from befs_find_brun_direct Salah Triki <salah.triki@gmail.com> - 2016-07-27 05:20 +0200
  [RESEND PATCH 3/4] fs: befs: Remove useless calls to brelse in befs_find_brun_dblindirect Salah Triki <salah.triki@gmail.com> - 2016-07-27 05:20 +0200
  [RESEND PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr Salah Triki <salah.triki@gmail.com> - 2016-07-27 05:20 +0200
    Re: [RESEND PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-27 17:40 +0200
  Re: [RESEND PATCH 1/4] fs: befs: Remove redundant validation from  befs_find_brun_direct Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-27 17:30 +0200

csiph-web