summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 5b8a4c787387..f368c0dc0d6d 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -481,10 +481,10 @@ void crypto_unregister_alg(struct crypto_alg *alg)
if (WARN(ret, "Algorithm %s is not registered", alg->cra_driver_name))
return;
- if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1))
- return;
-
- if (alg->cra_type && alg->cra_type->destroy)
+ if (alg->cra_destroy)
+ crypto_alg_put(alg);
+ else if (!WARN_ON(refcount_read(&alg->cra_refcnt) != 1) &&
+ alg->cra_type && alg->cra_type->destroy)
alg->cra_type->destroy(alg);
crypto_remove_final(&list);