From: SF Markus Elfring <elfring@users.sourceforge.net>
To: tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Jon Maloy <jon.maloy@ericsson.com>,
Ying Xue <ying.xue@windriver.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] tipc: Use common error handling code in tipc_server_start()
Date: Wed, 8 Nov 2017 22:34:16 +0100 [thread overview]
Message-ID: <30323180-d194-1af1-892f-58fef0a7b6db@users.sourceforge.net> (raw)
In-Reply-To: <25790616-164d-fe3e-bda4-3155299a8171@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:18:35 +0100
* Improve jump targets so that a bit of exception handling can be better
reused at the end of this function.
* Adjust two condition checks.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/tipc/server.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/tipc/server.c b/net/tipc/server.c
index acaef80fb88c..7359d37e39cd 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -670,16 +670,19 @@ int tipc_server_start(struct tipc_server *s)
return -ENOMEM;
ret = tipc_work_start(s);
- if (ret < 0) {
- kmem_cache_destroy(s->rcvbuf_cache);
- return ret;
- }
+ if (ret)
+ goto destroy_cache;
+
ret = tipc_open_listening_sock(s);
- if (ret < 0) {
- tipc_work_stop(s);
- kmem_cache_destroy(s->rcvbuf_cache);
- return ret;
- }
+ if (ret)
+ goto stop_work;
+
+ return 0;
+
+stop_work:
+ tipc_work_stop(s);
+destroy_cache:
+ kmem_cache_destroy(s->rcvbuf_cache);
return ret;
}
--
2.15.0
next prev parent reply other threads:[~2017-11-08 21:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 21:33 [PATCH 0/2] tipc: Fine-tuning for three function implementations SF Markus Elfring
2017-11-08 21:34 ` SF Markus Elfring [this message]
2017-11-08 21:35 ` [PATCH 2/2] tipc: Improve a size determination in two functions 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=30323180-d194-1af1-892f-58fef0a7b6db@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/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).