Commit da753bea authored by Akinobu Mita's avatar Akinobu Mita Committed by David S. Miller

[NET]: use hlist_unhashed()

Use hlist_unhashed() rather than accessing inside data structure.
Signed-off-by: default avatarAkinobu Mita <mita@miraclelinux.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a536e077
...@@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct hlist_node *n) ...@@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct hlist_node *n)
static inline void hlist_del_init(struct hlist_node *n) static inline void hlist_del_init(struct hlist_node *n)
{ {
if (n->pprev) { if (!hlist_unhashed(n)) {
__hlist_del(n); __hlist_del(n);
INIT_HLIST_NODE(n); INIT_HLIST_NODE(n);
} }
......
...@@ -150,7 +150,7 @@ static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, ...@@ -150,7 +150,7 @@ static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
{ {
return tw->tw_death_node.pprev != NULL; return !hlist_unhashed(&tw->tw_death_node);
} }
static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw) static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw)
......
...@@ -279,7 +279,7 @@ static inline int sk_unhashed(const struct sock *sk) ...@@ -279,7 +279,7 @@ static inline int sk_unhashed(const struct sock *sk)
static inline int sk_hashed(const struct sock *sk) static inline int sk_hashed(const struct sock *sk)
{ {
return sk->sk_node.pprev != NULL; return !sk_unhashed(sk);
} }
static __inline__ void sk_node_init(struct hlist_node *node) static __inline__ void sk_node_init(struct hlist_node *node)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment