Commit 494f5063 authored by Zhengchao Shao's avatar Zhengchao Shao Committed by David S. Miller

net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()

If fq_codel_init() fails, qdisc_create() invokes fq_codel_destroy() to
clear resources. Therefore, remove redundant resource cleanup in
fq_codel_init().
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 40c79ce1
...@@ -478,26 +478,24 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, ...@@ -478,26 +478,24 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt,
if (opt) { if (opt) {
err = fq_codel_change(sch, opt, extack); err = fq_codel_change(sch, opt, extack);
if (err) if (err)
goto init_failure; return err;
} }
err = tcf_block_get(&q->block, &q->filter_list, sch, extack); err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
if (err) if (err)
goto init_failure; return err;
if (!q->flows) { if (!q->flows) {
q->flows = kvcalloc(q->flows_cnt, q->flows = kvcalloc(q->flows_cnt,
sizeof(struct fq_codel_flow), sizeof(struct fq_codel_flow),
GFP_KERNEL); GFP_KERNEL);
if (!q->flows) { if (!q->flows)
err = -ENOMEM; return -ENOMEM;
goto init_failure;
}
q->backlogs = kvcalloc(q->flows_cnt, sizeof(u32), GFP_KERNEL); q->backlogs = kvcalloc(q->flows_cnt, sizeof(u32), GFP_KERNEL);
if (!q->backlogs) { if (!q->backlogs)
err = -ENOMEM; return -ENOMEM;
goto alloc_failure;
}
for (i = 0; i < q->flows_cnt; i++) { for (i = 0; i < q->flows_cnt; i++) {
struct fq_codel_flow *flow = q->flows + i; struct fq_codel_flow *flow = q->flows + i;
...@@ -510,13 +508,6 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, ...@@ -510,13 +508,6 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt,
else else
sch->flags &= ~TCQ_F_CAN_BYPASS; sch->flags &= ~TCQ_F_CAN_BYPASS;
return 0; return 0;
alloc_failure:
kvfree(q->flows);
q->flows = NULL;
init_failure:
q->flows_cnt = 0;
return err;
} }
static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb) static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment