mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis de Bethencourt <luisbg@osg.samsung.com>
To: Salah Triki <salah.triki@gmail.com>,
	akpm@linux-foundation.org, viro@zeniv.linux.org.uk
Cc: mhocko@suse.com, vdavydov@virtuozzo.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr
Date: Sat, 02 Jul 2016 13:04:39 +0100	[thread overview]
Message-ID: <5777ADD7.3060303@osg.samsung.com> (raw)
In-Reply-To: <cacf72077e471632a52369656529df860961f0e1.1467446561.git.salah.triki@gmail.com>

On 02/07/16 09:05, 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 the log to familiarize
myself with the code or test a change.

An alternative in this case would be to add the function name to the error messages
just before those goto errors. But I don't think that would be better than the
current code.

Just as a heads up there are 2 similar cases to this in fs/befs/btree.c
error:
        befs_debug(sb, "<--- %s ERROR", __func__);
        return BEFS_ERR;

Thanks,
Luis

  reply	other threads:[~2016-07-02 12:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-02  8:05 [PATCH 1/4] fs: befs: Remove redundant validation from befs_find_brun_direct Salah Triki
2016-07-02  8:05 ` [PATCH 2/4] fs: befs: Coding style fix Salah Triki
2016-07-02 11:22   ` Luis de Bethencourt
2016-07-02  8:05 ` [PATCH 3/4] fs: befs: Remove useless calls to brelse in befs_find_brun_dblindirect Salah Triki
2016-07-02 11:51   ` Luis de Bethencourt
2016-07-02  8:05 ` [PATCH 4/4] fs: befs: Remove goto from befs_bread_iaddr Salah Triki
2016-07-02 12:04   ` Luis de Bethencourt [this message]
2016-07-02 11:38 ` [PATCH 1/4] fs: befs: Remove redundant validation from befs_find_brun_direct Luis de Bethencourt
2016-07-02 13:34   ` Salah Triki
2016-07-02 14:44     ` Luis de Bethencourt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5777ADD7.3060303@osg.samsung.com \
    --to=luisbg@osg.samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=salah.triki@gmail.com \
    --cc=vdavydov@virtuozzo.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome