pkt_sched: Annotate uninitialized var in sfq_enqueue()
[safe/jmp/linux-2.6] / net / sched / sch_htb.c
index f89fd71..5070643 100644 (file)
@@ -698,14 +698,14 @@ static struct rb_node *htb_id_find_next_upper(int prio, struct rb_node *n,
        while (n) {
                struct htb_class *cl =
                    rb_entry(n, struct htb_class, node[prio]);
-               if (id == cl->common.classid)
-                       return n;
 
                if (id > cl->common.classid) {
                        n = n->rb_right;
-               } else {
+               } else if (id < cl->common.classid) {
                        r = n;
                        n = n->rb_left;
+               } else {
+                       return n;
                }
        }
        return r;
@@ -726,7 +726,7 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio,
                u32 *pid;
        } stk[TC_HTB_MAXDEPTH], *sp = stk;
 
-       WARN_ON(!tree->rb_node);
+       BUG_ON(!tree->rb_node);
        sp->root = tree->rb_node;
        sp->pptr = pptr;
        sp->pid = pid;
@@ -746,9 +746,10 @@ static struct htb_class *htb_lookup_leaf(struct rb_root *tree, int prio,
                                *sp->pptr = (*sp->pptr)->rb_left;
                        if (sp > stk) {
                                sp--;
-                               WARN_ON(!*sp->pptr);
-                               if (!*sp->pptr)
+                               if (!*sp->pptr) {
+                                       WARN_ON(1);
                                        return NULL;
+                               }
                                htb_next_rb_node(sp->pptr);
                        }
                } else {
@@ -779,8 +780,7 @@ static struct sk_buff *htb_dequeue_tree(struct htb_sched *q, int prio,
 
        do {
 next:
-               WARN_ON(!cl);
-               if (!cl)
+               if (unlikely(!cl))
                        return NULL;
 
                /* class can be empty - it is unlikely but can be true if leaf