diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2017-04-19 23:21:22 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-21 19:58:15 +0200 |
commit | 4392053879717edb0c4756a3878c0274267e237b (patch) | |
tree | 4b6135513c77437534060999f462638e4766beb3 /net/sched/cls_route.c | |
parent | net_sched: move the empty tp check from ->destroy() to ->delete() (diff) | |
download | linux-4392053879717edb0c4756a3878c0274267e237b.tar.xz linux-4392053879717edb0c4756a3878c0274267e237b.zip |
net_sched: remove useless NULL to tp->root
There is no need to NULL tp->root in ->destroy(), since tp is
going to be freed very soon, and existing readers are still
safe to read them.
For cls_route, we always init its tp->root, so it can't be NULL,
we can drop more useless code.
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_route.c')
-rw-r--r-- | net/sched/cls_route.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index f4d687e04240..d63d5502ee02 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -140,8 +140,6 @@ static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, goto failure; id = dst->tclassid; - if (head == NULL) - goto old_method; iif = inet_iif(skb); @@ -194,15 +192,6 @@ restart: route4_set_fastmap(head, id, iif, ROUTE4_FAILURE); failure: return -1; - -old_method: - if (id && (TC_H_MAJ(id) == 0 || - !(TC_H_MAJ(id^tp->q->handle)))) { - res->classid = id; - res->class = 0; - return 0; - } - return -1; } static inline u32 to_hash(u32 id) @@ -234,9 +223,6 @@ static unsigned long route4_get(struct tcf_proto *tp, u32 handle) struct route4_filter *f; unsigned int h1, h2; - if (!head) - return 0; - h1 = to_hash(handle); if (h1 > 256) return 0; @@ -305,7 +291,6 @@ static void route4_destroy(struct tcf_proto *tp) kfree_rcu(b, rcu); } } - RCU_INIT_POINTER(tp->root, NULL); kfree_rcu(head, rcu); } |