linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] mptcp: use list_first_entry_or_null
@ 2020-06-15  8:34 Geliang Tang
  2020-06-15 20:05 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2020-06-15  8:34 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski
  Cc: Geliang Tang, netdev, mptcp, linux-kernel

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

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2] mptcp: use list_first_entry_or_null
  2020-06-15  8:34 [PATCH net-next v2] mptcp: use list_first_entry_or_null Geliang Tang
@ 2020-06-15 20:05 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-06-15 20:05 UTC (permalink / raw)
  To: geliangtang
  Cc: mathew.j.martineau, matthieu.baerts, kuba, netdev, mptcp, linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-15 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  8:34 [PATCH net-next v2] mptcp: use list_first_entry_or_null Geliang Tang
2020-06-15 20:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).