netdev
[Top] [All Lists]

[PATCH PKT_SCHED 4/22]: act_api.c: remove checks for impossible conditio

To: jamal <hadi@xxxxxxxxxx>
Subject: [PATCH PKT_SCHED 4/22]: act_api.c: remove checks for impossible conditions
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Mon, 10 Jan 2005 20:37:49 +0100
Cc: Maillist netdev <netdev@xxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041008 Debian/1.7.3-5

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/09 22:51:34+01:00 kaber@xxxxxxxxxxxx 
#   [PKT_SCHED]: act_api.c: remove checks for impossible conditions
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# net/sched/act_api.c
#   2005/01/09 22:51:25+01:00 kaber@xxxxxxxxxxxx +15 -34
#   [PKT_SCHED]: act_api.c: remove checks for impossible conditions
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c       2005-01-10 06:21:56 +01:00
+++ b/net/sched/act_api.c       2005-01-10 06:21:56 +01:00
@@ -191,26 +191,18 @@
 {
        struct tc_action *a;
 
-       for (a = act; act; a = act) {
-               if (a && a->ops && a->ops->cleanup) {
+       for (a = act; a; a = act) {
+               if (a->ops && a->ops->cleanup) {
                        DPRINTK("tcf_action_destroy destroying %p next %p\n",
-                               a, a->next ? a->next : NULL);
-                       act = act->next;
+                               a, a->next);
                        if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
                                module_put(a->ops->owner);
-                       
-                       a->ops = NULL;
+                       act = act->next;
                        kfree(a);
                } else { /*FIXME: Remove later - catch insertion bugs*/
                        printk("tcf_action_destroy: BUG? destroying NULL 
ops\n");
-                       if (a) {
-                               act = act->next;
-                               kfree(a);
-                       } else {
-                               printk("tcf_action_destroy: BUG? destroying "
-                                      "NULL action!\n");
-                               break;
-                       }
+                       act = act->next;
+                       kfree(a);
                }
        }
 }
@@ -220,7 +212,7 @@
 {
        int err = -EINVAL;
 
-       if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL))
+       if (a->ops == NULL || a->ops->dump == NULL)
                return err;
        return a->ops->dump(skb, a, bind, ref);
 }
@@ -232,8 +224,7 @@
        unsigned char *b = skb->tail;
        struct rtattr *r;
 
-       if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL) ||
-           (a->ops->kind == NULL))
+       if (a->ops == NULL || a->ops->dump == NULL)
                return err;
 
        RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
@@ -563,14 +554,9 @@
 {
        struct tc_action *a;
 
-       for (a = act; act; a = act) {
-               if (a) {
-                       act = act->next;
-                       a->ops = NULL;
-                       a->priv = NULL;
-                       kfree(a);
-               } else
-                       printk("cleanup_a: BUG? empty action\n");
+       for (a = act; a; a = act) {
+               act = a->next;
+               kfree(a);
        }
 }
 
@@ -715,7 +701,7 @@
                if (tb[i] == NULL)
                        break;
                act = create_a(i+1);
-               if (a != NULL && a != act) {
+               if (a != NULL) {
                        a->next = act;
                        a = act;
                } else
@@ -826,14 +812,9 @@
         * stays intact
         * */
        ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags);
-       for (a = act; act; a = act) {
-               if (a) {
-                       act = act->next;
-                       a->ops = NULL;
-                       a->priv = NULL;
-                       kfree(a);
-               } else
-                       printk("tcf_action_add: BUG? empty action\n");
+       for (a = act; a; a = act) {
+               act = a->next;
+               kfree(a);
        }
 done:
        return ret;
<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH PKT_SCHED 4/22]: act_api.c: remove checks for impossible conditions, Patrick McHardy <=