Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: small skb_segment() cleanup
@ 2013-05-17 17:13 Eric Dumazet
  2013-05-17 17:20 ` Harvey Harrison
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2013-05-17 17:13 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

if (cond) {
	...
	__skb_put(nskb, doffset);
} else {
	...
	__skb_put(nskb, doffset);
}

can be simplified to

if (cond) {
	...
} else {
	...
}
__skb_put(nskb, doffset);


Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/skbuff.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index af9185d..87b5814 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2817,7 +2817,6 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
 
 			nskb->truesize += skb_end_offset(nskb) - hsize;
 			skb_release_head_state(nskb);
-			__skb_push(nskb, doffset);
 		} else {
 			nskb = __alloc_skb(hsize + doffset + headroom,
 					   GFP_ATOMIC, skb_alloc_rx_flag(skb),
@@ -2827,8 +2826,8 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
 				goto err;
 
 			skb_reserve(nskb, headroom);
-			__skb_put(nskb, doffset);
 		}
+		__skb_put(nskb, doffset);
 
 		if (segs)
 			tail->next = nskb;

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

end of thread, other threads:[~2013-05-17 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17 17:13 [PATCH net-next] net: small skb_segment() cleanup Eric Dumazet
2013-05-17 17:20 ` Harvey Harrison
2013-05-17 17:27   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox