Skip to content

Commit 0cee6bb

Browse files
wangweidongdavem330
authored andcommitted
tipc: remove unnecessary variables and conditions
We remove a number of unnecessary variables and branches in TIPC. This patch is cosmetic and does not change the operation of TIPC in any way. Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Wang Weidong <wangweidong1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 810c23a commit 0cee6bb

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

net/tipc/name_table.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
148148
*/
149149
static struct sub_seq *tipc_subseq_alloc(u32 cnt)
150150
{
151-
struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
152-
return sseq;
151+
return kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
153152
}
154153

155154
/**

net/tipc/port.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,17 +832,14 @@ int __tipc_connect(u32 ref, struct tipc_port *p_ptr,
832832
*/
833833
int __tipc_disconnect(struct tipc_port *tp_ptr)
834834
{
835-
int res;
836-
837835
if (tp_ptr->connected) {
838836
tp_ptr->connected = 0;
839837
/* let timer expire on it's own to avoid deadlock! */
840838
tipc_nodesub_unsubscribe(&tp_ptr->subscription);
841-
res = 0;
842-
} else {
843-
res = -ENOTCONN;
839+
return 0;
844840
}
845-
return res;
841+
842+
return -ENOTCONN;
846843
}
847844

848845
/*

net/tipc/socket.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ static int tipc_sk_create(struct net *net, struct socket *sock, int protocol,
239239
int tipc_sock_create_local(int type, struct socket **res)
240240
{
241241
int rc;
242-
struct sock *sk;
243242

244243
rc = sock_create_lite(AF_TIPC, type, 0, res);
245244
if (rc < 0) {
@@ -248,8 +247,6 @@ int tipc_sock_create_local(int type, struct socket **res)
248247
}
249248
tipc_sk_create(&init_net, *res, 0, 1);
250249

251-
sk = (*res)->sk;
252-
253250
return 0;
254251
}
255252

@@ -1311,14 +1308,12 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
13111308
static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf)
13121309
{
13131310
struct tipc_msg *msg = buf_msg(buf);
1314-
unsigned int limit;
13151311

13161312
if (msg_connected(msg))
1317-
limit = sysctl_tipc_rmem[2];
1318-
else
1319-
limit = sk->sk_rcvbuf >> TIPC_CRITICAL_IMPORTANCE <<
1320-
msg_importance(msg);
1321-
return limit;
1313+
return sysctl_tipc_rmem[2];
1314+
1315+
return sk->sk_rcvbuf >> TIPC_CRITICAL_IMPORTANCE <<
1316+
msg_importance(msg);
13221317
}
13231318

13241319
/**

0 commit comments

Comments
 (0)