public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain.net>
To: Horms <horms@verge.net.au>
Cc: linux-kernel@vger.kernel.org,
	Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: Re: [PATCH] NFS Client: remove supurflous goto from nfs_create_client()
Date: Fri, 10 Mar 2006 14:03:15 +1300	[thread overview]
Message-ID: <4410D053.1000303@vilain.net> (raw)
In-Reply-To: <20060309092341.GA26949@verge.net.au>

Horms wrote:

>--- a/fs/nfs/inode.c
>+++ b/fs/nfs/inode.c
>@@ -408,16 +408,13 @@ nfs_create_client(struct nfs_server *ser
> 	if (IS_ERR(clnt)) {
> 		dprintk("%s: cannot create RPC client. Error = %ld\n",
> 				__FUNCTION__, PTR_ERR(xprt));
>-		goto out_fail;
>+		return clnt;
> 	}
> 
> 	clnt->cl_intr     = 1;
> 	clnt->cl_softrtry = 1;
> 
> 	return clnt;
>-
>-out_fail:
>-	return clnt;
> }
>  
>

Why not just move the label?

I think it is nicer if all of the exit points of a function are at the
end, I've observed this to be a common convention and its success has
actually made me jump off the 'goto=hell' bandwagon.

gcc might even be optimising those duplicate instructions to a single
one, so the duplication would be good documentation.

Sam.

  reply	other threads:[~2006-03-10  1:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  9:23 [PATCH] NFS Client: remove supurflous goto from nfs_create_client() Horms
2006-03-10  1:03 ` Sam Vilain [this message]
2006-03-10  2:24   ` Horms

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=4410D053.1000303@vilain.net \
    --to=sam@vilain.net \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /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