Skip to content

Commit

Permalink
pktgen: remove some pointless conditionals before kfree_skb()
Browse files Browse the repository at this point in the history
Remove some pointless conditionals before kfree_skb().

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Feb 27, 2009
1 parent 6f96106 commit 86dc1ad
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3275,8 +3275,7 @@ static void pktgen_stop(struct pktgen_thread *t)

list_for_each_entry(pkt_dev, &t->if_list, list) {
pktgen_stop_device(pkt_dev);
if (pkt_dev->skb)
kfree_skb(pkt_dev->skb);
kfree_skb(pkt_dev->skb);

pkt_dev->skb = NULL;
}
Expand All @@ -3303,8 +3302,7 @@ static void pktgen_rem_one_if(struct pktgen_thread *t)
if (!cur->removal_mark)
continue;

if (cur->skb)
kfree_skb(cur->skb);
kfree_skb(cur->skb);
cur->skb = NULL;

pktgen_remove_device(t, cur);
Expand All @@ -3328,8 +3326,7 @@ static void pktgen_rem_all_ifs(struct pktgen_thread *t)
list_for_each_safe(q, n, &t->if_list) {
cur = list_entry(q, struct pktgen_dev, list);

if (cur->skb)
kfree_skb(cur->skb);
kfree_skb(cur->skb);
cur->skb = NULL;

pktgen_remove_device(t, cur);
Expand Down Expand Up @@ -3393,8 +3390,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)

if (!netif_running(odev)) {
pktgen_stop_device(pkt_dev);
if (pkt_dev->skb)
kfree_skb(pkt_dev->skb);
kfree_skb(pkt_dev->skb);
pkt_dev->skb = NULL;
goto out;
}
Expand All @@ -3415,8 +3411,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
if ((++pkt_dev->clone_count >= pkt_dev->clone_skb)
|| (!pkt_dev->skb)) {
/* build a new pkt */
if (pkt_dev->skb)
kfree_skb(pkt_dev->skb);
kfree_skb(pkt_dev->skb);

pkt_dev->skb = fill_packet(odev, pkt_dev);
if (pkt_dev->skb == NULL) {
Expand Down Expand Up @@ -3498,8 +3493,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)

/* Done with this */
pktgen_stop_device(pkt_dev);
if (pkt_dev->skb)
kfree_skb(pkt_dev->skb);
kfree_skb(pkt_dev->skb);
pkt_dev->skb = NULL;
}
out:;
Expand Down

0 comments on commit 86dc1ad

Please sign in to comment.