diff mbox series

[net-next,v2] mptcp: use list_first_entry_or_null

Message ID 6cf9b609f1d77b389165448b9a9b38f6bee48f87.1592209896.git.geliangtang@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next,v2] mptcp: use list_first_entry_or_null | expand

Commit Message

Geliang Tang June 15, 2020, 8:34 a.m. UTC
Use list_first_entry_or_null to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 Changes in v2:
  - Add "net-next" tag in Subject.
---
 net/mptcp/protocol.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

David Miller June 15, 2020, 8:05 p.m. UTC | #1
From: Geliang Tang <geliangtang@gmail.com>
Date: Mon, 15 Jun 2020 16:34:28 +0800

> Use list_first_entry_or_null to simplify the code.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 70ed698bd206..db56535dfc29 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -232,10 +232,7 @@  static inline struct mptcp_data_frag *mptcp_rtx_head(const struct sock *sk)
 {
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
-	if (list_empty(&msk->rtx_queue))
-		return NULL;
-
-	return list_first_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
+	return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list);
 }
 
 struct mptcp_subflow_request_sock {