Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1712119
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4/5] net/9p: Adjust a jump target in p9_client_attach() |
| Date | 2017-08-15 14:10 +0200 |
| Message-ID | <ueIPv-19O-1@gated-at.bofh.it> (permalink) |
| References | <ueIFQ-RA-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] net/9p: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-15 14:00 +0200
[PATCH 4/5] net/9p: Adjust a jump target in p9_client_attach() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-15 14:10 +0200
[PATCH 5/5] net/9p: Delete an unnecessary variable initialisation in p9_client_attach() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-15 14:10 +0200
[PATCH 3/5] net/9p: Add a jump target in p9_client_walk() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-15 14:10 +0200
[PATCH 2/5] net/9p: Improve 19 size determinations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-15 14:10 +0200
Re: [PATCH 2/5] net/9p: Improve 19 size determinations Al Viro <viro@ZenIV.linux.org.uk> - 2017-08-15 16:30 +0200
csiph-web