aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index ec4d46399d59..85acab9dc6fd 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1117,30 +1117,29 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1117{ 1117{
1118 struct htb_class *cl = (struct htb_class *)arg; 1118 struct htb_class *cl = (struct htb_class *)arg;
1119 1119
1120 if (cl && !cl->level) { 1120 if (cl->level)
1121 if (new == NULL && 1121 return -EINVAL;
1122 (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, 1122 if (new == NULL &&
1123 &pfifo_qdisc_ops, 1123 (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
1124 cl->common.classid)) 1124 &pfifo_qdisc_ops,
1125 == NULL) 1125 cl->common.classid)) == NULL)
1126 return -ENOBUFS; 1126 return -ENOBUFS;
1127 sch_tree_lock(sch); 1127
1128 *old = cl->un.leaf.q; 1128 sch_tree_lock(sch);
1129 cl->un.leaf.q = new; 1129 *old = cl->un.leaf.q;
1130 if (*old != NULL) { 1130 cl->un.leaf.q = new;
1131 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); 1131 if (*old != NULL) {
1132 qdisc_reset(*old); 1132 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1133 } 1133 qdisc_reset(*old);
1134 sch_tree_unlock(sch);
1135 return 0;
1136 } 1134 }
1137 return -ENOENT; 1135 sch_tree_unlock(sch);
1136 return 0;
1138} 1137}
1139 1138
1140static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg) 1139static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg)
1141{ 1140{
1142 struct htb_class *cl = (struct htb_class *)arg; 1141 struct htb_class *cl = (struct htb_class *)arg;
1143 return (cl && !cl->level) ? cl->un.leaf.q : NULL; 1142 return !cl->level ? cl->un.leaf.q : NULL;
1144} 1143}
1145 1144
1146static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg) 1145static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg)