From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbcGBMEp (ORCPT ); Sat, 2 Jul 2016 08:04:45 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:45448 "EHLO s-opensource.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750728AbcGBMEo (ORCPT ); Sat, 2 Jul 2016 08:04:44 -0400 Message-ID: <5777ADD7.3060303@osg.samsung.com> Date: Sat, 02 Jul 2016 13:04:39 +0100 From: Luis de Bethencourt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Salah Triki , 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 References: <9859a616787673d2f36ce21d4aa0220637c55001.1467446561.git.salah.triki@gmail.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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