Skip to content

Commit 494f506

Browse files
zhengchaoshaodavem330
authored andcommitted
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: Zhengchao Shao <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 40c79ce commit 494f506

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

net/sched/sch_fq_codel.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -478,26 +478,24 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt,
478478
if (opt) {
479479
err = fq_codel_change(sch, opt, extack);
480480
if (err)
481-
goto init_failure;
481+
return err;
482482
}
483483

484484
err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
485485
if (err)
486-
goto init_failure;
486+
return err;
487487

488488
if (!q->flows) {
489489
q->flows = kvcalloc(q->flows_cnt,
490490
sizeof(struct fq_codel_flow),
491491
GFP_KERNEL);
492-
if (!q->flows) {
493-
err = -ENOMEM;
494-
goto init_failure;
495-
}
492+
if (!q->flows)
493+
return -ENOMEM;
494+
496495
q->backlogs = kvcalloc(q->flows_cnt, sizeof(u32), GFP_KERNEL);
497-
if (!q->backlogs) {
498-
err = -ENOMEM;
499-
goto alloc_failure;
500-
}
496+
if (!q->backlogs)
497+
return -ENOMEM;
498+
501499
for (i = 0; i < q->flows_cnt; i++) {
502500
struct fq_codel_flow *flow = q->flows + i;
503501

@@ -510,13 +508,6 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt,
510508
else
511509
sch->flags &= ~TCQ_F_CAN_BYPASS;
512510
return 0;
513-
514-
alloc_failure:
515-
kvfree(q->flows);
516-
q->flows = NULL;
517-
init_failure:
518-
q->flows_cnt = 0;
519-
return err;
520511
}
521512

522513
static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb)

0 commit comments

Comments
 (0)