Add changes from the Linux-2.6 tree.
[linux-2.6.git] / drivers / md / dm-target.c
index 2f67b4d..477a041 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/bio.h>
 #include <linux/slab.h>
 
+#define DM_MSG_PREFIX "target"
+
 struct tt_internal {
        struct target_type tt;
 
@@ -78,8 +80,7 @@ void dm_put_target_type(struct target_type *t)
        if (--ti->use == 0)
                module_put(ti->tt.module);
 
-       if (ti->use < 0)
-               BUG();
+       BUG_ON(ti->use < 0);
        up_read(&_lock);
 
        return;
@@ -120,10 +121,9 @@ int dm_register_target(struct target_type *t)
                return -ENOMEM;
 
        down_write(&_lock);
-       if (__find_target_type(t->name)) {
-               kfree(ti);
+       if (__find_target_type(t->name))
                rv = -EEXIST;
-       else
+       else
                list_add(&ti->list, &_targets);
 
        up_write(&_lock);