Subject: [PATCH net-next] gro: avoid checking for a failed search

From: Richard Gobert <[email-masked]>
Date: Mon, 24 Oct 2022 07:17:49 +0200

After searching for a protocol handler in dev_gro_receive, checking for
failure is redundant. Skip the failure code after finding the 
corresponding handler.

Signed-off-by: Richard Gobert <[email-masked]>
---
 net/core/gro.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/gro.c b/net/core/gro.c
index bc9451743307..a4e1b5a5be64 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -522,13 +522,13 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 		pp = INDIRECT_CALL_INET(ptype->callbacks.gro_receive,
 					ipv6_gro_receive, inet_gro_receive,
 					&gro_list->list, skb);
-		break;
+		rcu_read_unlock();
+		goto found;
 	}
 	rcu_read_unlock();
+	goto normal;
 
-	if (&ptype->list == head)
-		goto normal;
-
+found:
 	if (PTR_ERR(pp) == -EINPROGRESS) {
 		ret = GRO_CONSUMED;
 		goto ok;
-- 
2.20.1