public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Ron Minnich <rminnich@sandia.gov>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/5] net/9p: Adjust a jump target in p9_client_attach()
Date: Tue, 15 Aug 2017 14:02:15 +0200	[thread overview]
Message-ID: <ace81690-0817-7271-13eb-e510c83d7daa@users.sourceforge.net> (raw)
In-Reply-To: <22a44d7c-cdb9-e206-4b2c-56e38cbf0de1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 15 Aug 2017 11:17:23 +0200

Adjust jump labels so that the function implementation becomes smaller.

Delete an extra variable assignment and a check (at the end of
this function).

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/9p/client.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index 6c2fc796edfb..38c08171acc6 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1133,25 +1133,23 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
 	p9_debug(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n",
 		 afid ? afid->fid : -1, uname, aname);
 	fid = p9_fid_create(clnt);
-	if (IS_ERR(fid)) {
-		err = PTR_ERR(fid);
-		fid = NULL;
-		goto error;
-	}
+	if (IS_ERR(fid))
+		return fid;
+
 	fid->uid = n_uname;
 
 	req = p9_client_rpc(clnt, P9_TATTACH, "ddss?u", fid->fid,
 			afid ? afid->fid : P9_NOFID, uname, aname, n_uname);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
-		goto error;
+		goto destroy_fid;
 	}
 
 	err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid);
 	if (err) {
 		trace_9p_protocol_dump(clnt, req->rc);
 		p9_free_req(clnt, req);
-		goto error;
+		goto destroy_fid;
 	}
 
 	p9_debug(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n",
@@ -1161,10 +1159,8 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid,
 
 	p9_free_req(clnt, req);
 	return fid;
-
-error:
-	if (fid)
-		p9_fid_destroy(fid);
+destroy_fid:
+	p9_fid_destroy(fid);
 	return ERR_PTR(err);
 }
 EXPORT_SYMBOL(p9_client_attach);
-- 
2.14.0

  parent reply	other threads:[~2017-08-15 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 11:56 [PATCH 0/5] net/9p: Fine-tuning for some function implementations SF Markus Elfring
2017-08-15 11:58 ` [PATCH 1/5] net/9p: Delete an error message for a failed memory allocation in five functions SF Markus Elfring
2017-08-15 12:00 ` [PATCH 2/5] net/9p: Improve 19 size determinations SF Markus Elfring
2017-08-15 14:21   ` Al Viro
2017-08-15 12:01 ` [PATCH 3/5] net/9p: Add a jump target in p9_client_walk() SF Markus Elfring
2017-08-15 12:02 ` SF Markus Elfring [this message]
2017-08-15 12:03 ` [PATCH 5/5] net/9p: Delete an unnecessary variable initialisation in p9_client_attach() SF Markus Elfring

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=ace81690-0817-7271-13eb-e510c83d7daa@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=ericvh@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=rminnich@sandia.gov \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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