Skip to content

Commit

Permalink
[NET]: use hlist_unhashed()
Browse files Browse the repository at this point in the history
Use hlist_unhashed() rather than accessing inside data structure.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Akinobu Mita authored and David S. Miller committed Apr 30, 2006
1 parent a536e07 commit da753be
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct hlist_node *n)

static inline void hlist_del_init(struct hlist_node *n)
{
if (n->pprev) {
if (!hlist_unhashed(n)) {
__hlist_del(n);
INIT_HLIST_NODE(n);
}
Expand Down
2 changes: 1 addition & 1 deletion include/net/inet_timewait_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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)
Expand Down
2 changes: 1 addition & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static inline int sk_unhashed(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)
Expand Down

0 comments on commit da753be

Please sign in to comment.