From: Geliang Tang <geliangtang@gmail.com>
Date: Fri, 20 Jan 2017 14:27:04 +0000 (+0800)
Subject: sock: use hlist_entry_safe
X-Git-Tag: v4.11-rc1~124^2~369
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6c59ebd356ff2ca64cdf1f61c5fe17f6fa8fc045;p=linux.git

sock: use hlist_entry_safe

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>
---

diff --git a/include/net/sock.h b/include/net/sock.h
index 389a0a619b45..7144750d14e5 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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)