Skip to content

Commit 18d0700

Browse files
edumazetdavem330
authored andcommitted
net: skb_peek()/skb_peek_tail() cleanups
remove useless casts and rename variables for less confusion. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e4cbb02 commit 18d0700

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎include/linux/skbuff.h‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -883,10 +883,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
883883
*/
884884
static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
885885
{
886-
struct sk_buff *list = ((const struct sk_buff *)list_)->next;
887-
if (list == (struct sk_buff *)list_)
888-
list = NULL;
889-
return list;
886+
struct sk_buff *skb = list_->next;
887+
888+
if (skb == (struct sk_buff *)list_)
889+
skb = NULL;
890+
return skb;
890891
}
891892

892893
/**
@@ -902,6 +903,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
902903
const struct sk_buff_head *list_)
903904
{
904905
struct sk_buff *next = skb->next;
906+
905907
if (next == (struct sk_buff *)list_)
906908
next = NULL;
907909
return next;
@@ -922,10 +924,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
922924
*/
923925
static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
924926
{
925-
struct sk_buff *list = ((const struct sk_buff *)list_)->prev;
926-
if (list == (struct sk_buff *)list_)
927-
list = NULL;
928-
return list;
927+
struct sk_buff *skb = list_->prev;
928+
929+
if (skb == (struct sk_buff *)list_)
930+
skb = NULL;
931+
return skb;
932+
929933
}
930934

931935
/**

0 commit comments

Comments
 (0)