]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - lib/debugobjects.c
misc: tegra-profiler: fix stopping the session
[linux-3.10.git] / lib / debugobjects.c
index 3e5cd7c04a55229c546b599864ccf7b9b62734a0..37061ede8b8124e7fa59cd0963ede7ba27979007 100644 (file)
@@ -95,7 +95,7 @@ static void fill_pool(void)
 
                new = kmem_cache_zalloc(obj_cache, gfp);
                if (!new)
-                       return obj_pool_free;
+                       return;
 
                raw_spin_lock_irqsave(&pool_lock, flags);
                hlist_add_head(&new->node, &obj_pool);
@@ -109,11 +109,10 @@ static void fill_pool(void)
  */
 static struct debug_obj *lookup_object(void *addr, struct debug_bucket *b)
 {
-       struct hlist_node *node;
        struct debug_obj *obj;
        int cnt = 0;
 
-       hlist_for_each_entry(obj, node, &b->list, node) {
+       hlist_for_each_entry(obj, &b->list, node) {
                cnt++;
                if (obj->object == addr)
                        return obj;
@@ -213,7 +212,7 @@ static void free_object(struct debug_obj *obj)
 static void debug_objects_oom(void)
 {
        struct debug_bucket *db = obj_hash;
-       struct hlist_node *node, *tmp;
+       struct hlist_node *tmp;
        HLIST_HEAD(freelist);
        struct debug_obj *obj;
        unsigned long flags;
@@ -227,7 +226,7 @@ static void debug_objects_oom(void)
                raw_spin_unlock_irqrestore(&db->lock, flags);
 
                /* Now free them */
-               hlist_for_each_entry_safe(obj, node, tmp, &freelist, node) {
+               hlist_for_each_entry_safe(obj, tmp, &freelist, node) {
                        hlist_del(&obj->node);
                        free_object(obj);
                }
@@ -658,7 +657,7 @@ debug_object_active_state(void *addr, struct debug_obj_descr *descr,
 static void __debug_check_no_obj_freed(const void *address, unsigned long size)
 {
        unsigned long flags, oaddr, saddr, eaddr, paddr, chunks;
-       struct hlist_node *node, *tmp;
+       struct hlist_node *tmp;
        HLIST_HEAD(freelist);
        struct debug_obj_descr *descr;
        enum debug_obj_state state;
@@ -678,7 +677,7 @@ static void __debug_check_no_obj_freed(const void *address, unsigned long size)
 repeat:
                cnt = 0;
                raw_spin_lock_irqsave(&db->lock, flags);
-               hlist_for_each_entry_safe(obj, node, tmp, &db->list, node) {
+               hlist_for_each_entry_safe(obj, tmp, &db->list, node) {
                        cnt++;
                        oaddr = (unsigned long) obj->object;
                        if (oaddr < saddr || oaddr >= eaddr)
@@ -702,7 +701,7 @@ repeat:
                raw_spin_unlock_irqrestore(&db->lock, flags);
 
                /* Now free them */
-               hlist_for_each_entry_safe(obj, node, tmp, &freelist, node) {
+               hlist_for_each_entry_safe(obj, tmp, &freelist, node) {
                        hlist_del(&obj->node);
                        free_object(obj);
                }
@@ -1013,7 +1012,7 @@ void __init debug_objects_early_init(void)
 static int __init debug_objects_replace_static_objects(void)
 {
        struct debug_bucket *db = obj_hash;
-       struct hlist_node *node, *tmp;
+       struct hlist_node *tmp;
        struct debug_obj *obj, *new;
        HLIST_HEAD(objects);
        int i, cnt = 0;
@@ -1033,7 +1032,7 @@ static int __init debug_objects_replace_static_objects(void)
        local_irq_disable();
 
        /* Remove the statically allocated objects from the pool */
-       hlist_for_each_entry_safe(obj, node, tmp, &obj_pool, node)
+       hlist_for_each_entry_safe(obj, tmp, &obj_pool, node)
                hlist_del(&obj->node);
        /* Move the allocated objects to the pool */
        hlist_move_list(&objects, &obj_pool);
@@ -1042,7 +1041,7 @@ static int __init debug_objects_replace_static_objects(void)
        for (i = 0; i < ODEBUG_HASH_SIZE; i++, db++) {
                hlist_move_list(&db->list, &objects);
 
-               hlist_for_each_entry(obj, node, &objects, node) {
+               hlist_for_each_entry(obj, &objects, node) {
                        new = hlist_entry(obj_pool.first, typeof(*obj), node);
                        hlist_del(&new->node);
                        /* copy object data */
@@ -1051,13 +1050,13 @@ static int __init debug_objects_replace_static_objects(void)
                        cnt++;
                }
        }
+       local_irq_enable();
 
        printk(KERN_DEBUG "ODEBUG: %d of %d active objects replaced\n", cnt,
               obj_pool_used);
-       local_irq_enable();
        return 0;
 free:
-       hlist_for_each_entry_safe(obj, node, tmp, &objects, node) {
+       hlist_for_each_entry_safe(obj, tmp, &objects, node) {
                hlist_del(&obj->node);
                kmem_cache_free(obj_cache, obj);
        }