summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-04-02 22:39:40 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-03 17:53:32 +0800
commit87b1675634e1e9f1570445c55604204771ac9078 (patch)
tree94de40f13b4e73cb4e925278a2119a8bdf3df764 /crypto
parent1f7237109951ebe8dc194461716443a5d8caf308 (diff)
downloadlinux-87b1675634e1e9f1570445c55604204771ac9078.tar.bz2
crypto: api - Change crypto_unregister_instance argument type
This patch makes crypto_unregister_instance take a crypto_instance instead of a crypto_alg. This allows us to remove a duplicate CRYPTO_ALG_INSTANCE check in crypto_unregister_instance. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/algapi.c8
-rw-r--r--crypto/crypto_user.c2
2 files changed, 3 insertions, 7 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 0f1976eceb27..f1d0307b1d08 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -551,17 +551,13 @@ err:
}
EXPORT_SYMBOL_GPL(crypto_register_instance);
-int crypto_unregister_instance(struct crypto_alg *alg)
+int crypto_unregister_instance(struct crypto_instance *inst)
{
- struct crypto_instance *inst = (void *)alg;
LIST_HEAD(list);
- if (!(alg->cra_flags & CRYPTO_ALG_INSTANCE))
- return -EINVAL;
-
down_write(&crypto_alg_sem);
- crypto_remove_spawns(alg, &list, NULL);
+ crypto_remove_spawns(&inst->alg, &list, NULL);
crypto_remove_instance(inst, &list);
up_write(&crypto_alg_sem);
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index c5148a35ae0a..eab249723830 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -316,7 +316,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh,
if (atomic_read(&alg->cra_refcnt) != 1)
return -EBUSY;
- return crypto_unregister_instance(alg);
+ return crypto_unregister_instance((struct crypto_instance *)alg);
}
static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type,