OSDN Git Service

net: sched: remove unnecessary init of qdisc skb head
authorZhengchao Shao <shaozhengchao@huawei.com>
Wed, 24 Aug 2022 09:10:03 +0000 (17:10 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Aug 2022 11:03:04 +0000 (12:03 +0100)
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>
include/net/sch_generic.h
net/sched/sch_generic.c
net/sched/sch_htb.c

index f2958fb..7dc8340 100644 (file)
@@ -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)
 {
index 99b697a..8d25b41 100644 (file)
@@ -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);
 
index cb5872d..dbbb276 100644 (file)
@@ -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