]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - crypto/algapi.c
Merge tag 'dlm-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
[karo-tx-linux.git] / crypto / algapi.c
index 3c079b7f23f6bada906f9d444a50cd15b0831d65..d130b41dbaea244000c35328d7eba7b463158bc8 100644 (file)
@@ -67,12 +67,22 @@ static int crypto_check_alg(struct crypto_alg *alg)
        return crypto_set_driver_name(alg);
 }
 
+static void crypto_free_instance(struct crypto_instance *inst)
+{
+       if (!inst->alg.cra_type->free) {
+               inst->tmpl->free(inst);
+               return;
+       }
+
+       inst->alg.cra_type->free(inst);
+}
+
 static void crypto_destroy_instance(struct crypto_alg *alg)
 {
        struct crypto_instance *inst = (void *)alg;
        struct crypto_template *tmpl = inst->tmpl;
 
-       tmpl->free(inst);
+       crypto_free_instance(inst);
        crypto_tmpl_put(tmpl);
 }
 
@@ -481,7 +491,7 @@ void crypto_unregister_template(struct crypto_template *tmpl)
 
        hlist_for_each_entry_safe(inst, n, list, list) {
                BUG_ON(atomic_read(&inst->alg.cra_refcnt) != 1);
-               tmpl->free(inst);
+               crypto_free_instance(inst);
        }
        crypto_remove_final(&users);
 }
@@ -892,7 +902,7 @@ out:
 }
 EXPORT_SYMBOL_GPL(crypto_enqueue_request);
 
-void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset)
+struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue)
 {
        struct list_head *request;
 
@@ -907,14 +917,7 @@ void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset)
        request = queue->list.next;
        list_del(request);
 
-       return (char *)list_entry(request, struct crypto_async_request, list) -
-              offset;
-}
-EXPORT_SYMBOL_GPL(__crypto_dequeue_request);
-
-struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue)
-{
-       return __crypto_dequeue_request(queue, 0);
+       return list_entry(request, struct crypto_async_request, list);
 }
 EXPORT_SYMBOL_GPL(crypto_dequeue_request);