X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsched%2Fcls_basic.c;h=23e4459beac30a6d5aab1eb0bf11be7581e40e2c;hb=refs%2Fheads%2Fvserver;hp=0f425448fdf6ed581f62736bd08f268bea925155;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 0f425448f..23e4459be 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c @@ -9,7 +9,6 @@ * Authors: Thomas Graf */ -#include #include #include #include @@ -83,6 +82,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; } @@ -178,20 +184,9 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle, } err = -ENOBUFS; - if (head == NULL) { - head = kmalloc(sizeof(*head), GFP_KERNEL); - if (head == NULL) - goto errout; - - memset(head, 0, sizeof(*head)); - INIT_LIST_HEAD(&head->flist); - tp->root = head; - } - - f = kmalloc(sizeof(*f), GFP_KERNEL); + f = kzalloc(sizeof(*f), GFP_KERNEL); if (f == NULL) goto errout; - memset(f, 0, sizeof(*f)); err = -EINVAL; if (handle)