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 RFC v1] 9p/trans_fd: Use common error handling code in p9_fd_create_tcp()
Date: Tue, 7 Nov 2017 17:21:25 +0100 [thread overview]
Message-ID: <827791c8-6eae-18ff-80e5-192b609e555f@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 Nov 2017 10:05:20 +0100
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
v1 - Request for comments:
I can offer another bit of information for a software development discussion. 💭
The affected source file can be compiled for the processor architecture “x86_64”
by a tool like “GCC 6.4.1+r251631-1.3” from the software distribution
“openSUSE Tumbleweed” with the following command example.
my_cc=/usr/bin/gcc-6 \
&& my_module=net/9p/trans_fd.o \
&& for XYZ in 0 s 3; do echo " _____ $XYZ _____" \
&& my_extra="-O$XYZ" \
&& git checkout next-20171102 \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}" \
&& git checkout ':/^9p/trans_fd: Use common error handling code in p9_fd_create_tcp' \
&& make -j4 CC="${my_cc}" HOSTCC="${my_cc}" EXTRA_CFLAGS="${my_extra}" allmodconfig "${my_module}" \
&& size "${my_module}"; done
🔮 Do you find the following differences worth for further clarification?
╔═════════╤══════╗
║ setting │ text ║
╠═════════╪══════╣
║ O0 │ -14 ║
║ Os │ +13 ║
║ O3 │ 0 ║
╚═════════╧══════╝
net/9p/trans_fd.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 903a190319b9..161c2249ca2a 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -974,8 +974,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
if (err < 0) {
pr_err("%s (%d): problem binding to privport\n",
__func__, task_pid_nr(current));
- sock_release(csocket);
- return err;
+ goto release_socket;
}
}
@@ -985,11 +984,14 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
if (err < 0) {
pr_err("%s (%d): problem connecting socket to %s\n",
__func__, task_pid_nr(current), addr);
- sock_release(csocket);
- return err;
+ goto release_socket;
}
return p9_socket_open(client, csocket);
+
+release_socket:
+ sock_release(csocket);
+ return err;
}
static int
--
2.15.0
reply other threads:[~2017-11-07 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=827791c8-6eae-18ff-80e5-192b609e555f@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;
as well as URLs for NNTP newsgroup(s).