.owner          = THIS_MODULE,
 };
 
-static struct nvm_tgt_type *nvm_find_target_type(const char *name, int lock)
+static struct nvm_tgt_type *__nvm_find_target_type(const char *name)
 {
-       struct nvm_tgt_type *tmp, *tt = NULL;
+       struct nvm_tgt_type *tt;
 
-       if (lock)
-               down_write(&nvm_tgtt_lock);
+       list_for_each_entry(tt, &nvm_tgt_types, list)
+               if (!strcmp(name, tt->name))
+                       return tt;
 
-       list_for_each_entry(tmp, &nvm_tgt_types, list)
-               if (!strcmp(name, tmp->name)) {
-                       tt = tmp;
-                       break;
-               }
+       return NULL;
+}
+
+static struct nvm_tgt_type *nvm_find_target_type(const char *name)
+{
+       struct nvm_tgt_type *tt;
+
+       down_write(&nvm_tgtt_lock);
+       tt = __nvm_find_target_type(name);
+       up_write(&nvm_tgtt_lock);
 
-       if (lock)
-               up_write(&nvm_tgtt_lock);
        return tt;
 }
 
        void *targetdata;
        int ret;
 
-       tt = nvm_find_target_type(create->tgttype, 1);
+       tt = nvm_find_target_type(create->tgttype);
        if (!tt) {
                pr_err("nvm: target type %s not found\n", create->tgttype);
                return -EINVAL;
        int ret = 0;
 
        down_write(&nvm_tgtt_lock);
-       if (nvm_find_target_type(tt->name, 0))
+       if (__nvm_find_target_type(tt->name))
                ret = -EEXIST;
        else
                list_add(&tt->list, &nvm_tgt_types);