[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <30323180-d194-1af1-892f-58fef0a7b6db@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:34:16 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: tipc-discussion@...ts.sourceforge.net, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jon Maloy <jon.maloy@...csson.com>,
Ying Xue <ying.xue@...driver.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] tipc: Use common error handling code in
tipc_server_start()
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists