Skip to contentSkip to conversation

net: skbuff.h: remove unnecessary unlikely()

PATCH In review Yangtao Li 2 participants 5 messages Nov 4, 2018 – Nov 5, 2018

Subsystems (2)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 net: skbuff.h: remove unnecessary unlikely()

WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely.

---
 include/linux/skbuff.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/linux/skbuff.h +1 -3
index 0ba687454267..7dcfb5591dc3 100644
@@ -2508,10 +2508,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len);
 
 static inline void __skb_set_length(struct sk_buff *skb, unsigned int len)
 {
-	if (unlikely(skb_is_nonlinear(skb))) {
-		WARN_ON(1);
+	if (WARN_ON(skb_is_nonlinear(skb)))
 		return;
-	}
 	skb->len = len;
 	skb_set_tail_pointer(skb, len);
 }
Signature · 1 line
2.17.0
author
#2 lore raw
In reply to Yangtao Li

add [email protected]
-- Yangtao

Quoted 28 lines · Yangtao Li

WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely.

---
 include/linux/skbuff.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/linux/skbuff.h +1 -4
index 0ba687454267..7dcfb5591dc3 100644
@@ -2508,10 +2508,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len);
 
 static inline void __skb_set_length(struct sk_buff *skb, unsigned int len)
 {
-       if (unlikely(skb_is_nonlinear(skb))) {
-               WARN_ON(1);
+       if (WARN_ON(skb_is_nonlinear(skb)))
                return;
-       }
        skb->len = len;
        skb_set_tail_pointer(skb, len);
 }
--

2.17.0

author
#3 lore raw

add myself.
-Yangtao

Quoted 32 lines · Frank Lee

add [email protected]
-- Yangtao

Quoted 28 lines · Yangtao Li

WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely.

---
 include/linux/skbuff.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
include/linux/skbuff.h +1 -4
index 0ba687454267..7dcfb5591dc3 100644
@@ -2508,10 +2508,8 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len);
 
 static inline void __skb_set_length(struct sk_buff *skb, unsigned int len)
 {
-       if (unlikely(skb_is_nonlinear(skb))) {
-               WARN_ON(1);
+       if (WARN_ON(skb_is_nonlinear(skb)))
                return;
-       }
        skb->len = len;
        skb_set_tail_pointer(skb, len);
 }
--

2.17.0