Skip to content

Commit

Permalink
net: sched: remove unnecessary init of qdisc skb head
Browse files Browse the repository at this point in the history
The memory allocated by using kzallloc_node and kcalloc has been cleared.
Therefore, the structure members of the new qdisc are 0. So there's no
need to explicitly assign a value of 0.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Zhengchao Shao authored and David S. Miller committed Aug 26, 2022
1 parent 643952f commit 44387d1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 10 deletions.
7 changes: 0 additions & 7 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -940,13 +940,6 @@ static inline void qdisc_purge_queue(struct Qdisc *sch)
qdisc_tree_reduce_backlog(sch, qlen, backlog);
}

static inline void qdisc_skb_head_init(struct qdisc_skb_head *qh)
{
qh->head = NULL;
qh->tail = NULL;
qh->qlen = 0;
}

static inline void __qdisc_enqueue_tail(struct sk_buff *skb,
struct qdisc_skb_head *qh)
{
Expand Down
1 change: 0 additions & 1 deletion net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,6 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
goto errout;
__skb_queue_head_init(&sch->gso_skb);
__skb_queue_head_init(&sch->skb_bad_txq);
qdisc_skb_head_init(&sch->q);
gnet_stats_basic_sync_init(&sch->bstats);
spin_lock_init(&sch->q.lock);

Expand Down
2 changes: 0 additions & 2 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,6 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt,
if (err < 0)
goto err_free_direct_qdiscs;

qdisc_skb_head_init(&q->direct_queue);

if (tb[TCA_HTB_DIRECT_QLEN])
q->direct_qlen = nla_get_u32(tb[TCA_HTB_DIRECT_QLEN]);
else
Expand Down

0 comments on commit 44387d1

Please sign in to comment.