net: Remove casts to same type
Adding casts of objects to the same type is unnecessary and confusing for a human reader. For example, this cast: int y; int *p = (int *)&y; I used the coccinelle script below to find and remove these unnecessary casts. I manually removed the conversions this script produces of casts with __force and __user. @@ type T; T *p; @@ - (T *)p + p Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
29a6b6c060
commit
e3192690a3
@ -909,8 +909,8 @@ int tipc_createport(void *usr_handle,
|
||||
warn("Port creation failed, no memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
p_ptr = (struct tipc_port *)tipc_createport_raw(NULL, port_dispatcher,
|
||||
port_wakeup, importance);
|
||||
p_ptr = tipc_createport_raw(NULL, port_dispatcher, port_wakeup,
|
||||
importance);
|
||||
if (!p_ptr) {
|
||||
kfree(up_ptr);
|
||||
return -ENOMEM;
|
||||
@ -1078,8 +1078,7 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr)
|
||||
if (tp_ptr->connected) {
|
||||
tp_ptr->connected = 0;
|
||||
/* let timer expire on it's own to avoid deadlock! */
|
||||
tipc_nodesub_unsubscribe(
|
||||
&((struct tipc_port *)tp_ptr)->subscription);
|
||||
tipc_nodesub_unsubscribe(&tp_ptr->subscription);
|
||||
res = 0;
|
||||
} else {
|
||||
res = -ENOTCONN;
|
||||
@ -1099,7 +1098,7 @@ int tipc_disconnect(u32 ref)
|
||||
p_ptr = tipc_port_lock(ref);
|
||||
if (!p_ptr)
|
||||
return -EINVAL;
|
||||
res = tipc_disconnect_port((struct tipc_port *)p_ptr);
|
||||
res = tipc_disconnect_port(p_ptr);
|
||||
tipc_port_unlock(p_ptr);
|
||||
return res;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ struct tipc_sock {
|
||||
};
|
||||
|
||||
#define tipc_sk(sk) ((struct tipc_sock *)(sk))
|
||||
#define tipc_sk_port(sk) ((struct tipc_port *)(tipc_sk(sk)->p))
|
||||
#define tipc_sk_port(sk) (tipc_sk(sk)->p)
|
||||
|
||||
#define tipc_rx_ready(sock) (!skb_queue_empty(&sock->sk->sk_receive_queue) || \
|
||||
(sock->state == SS_DISCONNECTING))
|
||||
|
Reference in New Issue
Block a user