Skip to content

Commit

Permalink
sock: use hlist_entry_safe
Browse files Browse the repository at this point in the history
Use hlist_entry_safe() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Geliang Tang authored and David S. Miller committed Jan 20, 2017
1 parent c10aa71 commit 6c59ebd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ static inline struct sock *sk_nulls_head(const struct hlist_nulls_head *head)

static inline struct sock *sk_next(const struct sock *sk)
{
return sk->sk_node.next ?
hlist_entry(sk->sk_node.next, struct sock, sk_node) : NULL;
return hlist_entry_safe(sk->sk_node.next, struct sock, sk_node);
}

static inline struct sock *sk_nulls_next(const struct sock *sk)
Expand Down

0 comments on commit 6c59ebd

Please sign in to comment.