Pull asus into release branch
[pandora-kernel.git] / net / sched / cls_basic.c
index 86cac49..4a91f08 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
@@ -82,6 +81,13 @@ static void basic_put(struct tcf_proto *tp, unsigned long f)
 
 static int basic_init(struct tcf_proto *tp)
 {
+       struct basic_head *head;
+
+       head = kzalloc(sizeof(*head), GFP_KERNEL);
+       if (head == NULL)
+               return -ENOBUFS;
+       INIT_LIST_HEAD(&head->flist);
+       tp->root = head;
        return 0;
 }
 
@@ -98,11 +104,12 @@ static void basic_destroy(struct tcf_proto *tp)
 {
        struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
        struct basic_filter *f, *n;
-       
+
        list_for_each_entry_safe(f, n, &head->flist, link) {
                list_del(&f->link);
                basic_delete_filter(tp, f);
        }
+       kfree(head);
 }
 
 static int basic_delete(struct tcf_proto *tp, unsigned long arg)
@@ -157,7 +164,7 @@ errout:
 }
 
 static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
-                       struct rtattr **tca, unsigned long *arg)
+                       struct rtattr **tca, unsigned long *arg)
 {
        int err = -EINVAL;
        struct basic_head *head = (struct basic_head *) tp->root;
@@ -177,15 +184,6 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        }
 
        err = -ENOBUFS;
-       if (head == NULL) {
-               head = kzalloc(sizeof(*head), GFP_KERNEL);
-               if (head == NULL)
-                       goto errout;
-
-               INIT_LIST_HEAD(&head->flist);
-               tp->root = head;
-       }
-
        f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL)
                goto errout;
@@ -194,7 +192,7 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        if (handle)
                f->handle = handle;
        else {
-               int i = 0x80000000;
+               unsigned int i = 0x80000000;
                do {
                        if (++head->hgenerator == 0x7FFFFFFF)
                                head->hgenerator = 1;
@@ -292,7 +290,7 @@ static int __init init_basic(void)
        return register_tcf_proto_ops(&cls_basic_ops);
 }
 
-static void __exit exit_basic(void) 
+static void __exit exit_basic(void)
 {
        unregister_tcf_proto_ops(&cls_basic_ops);
 }