mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
crypto: algapi - make unregistration functions return void
Some of the algorithm unregistration functions return -ENOENT when asked to unregister a non-registered algorithm, while others always return 0 or always return void. But no users check the return value, except for two of the bulk unregistration functions which print a message on error but still always return 0 to their caller, and crypto_del_alg() which calls crypto_unregister_instance() which always returns 0. Since unregistering a non-registered algorithm is always a kernel bug but there isn't anything callers should do to handle this situation at runtime, let's simplify things by making all the unregistration functions return void, and moving the error message into crypto_unregister_alg() and upgrading it to a WARN(). Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
0e89640b64
commit
c6d633a927
12 changed files with 42 additions and 71 deletions
|
@ -520,9 +520,9 @@ int crypto_register_shash(struct shash_alg *alg)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_shash);
|
||||
|
||||
int crypto_unregister_shash(struct shash_alg *alg)
|
||||
void crypto_unregister_shash(struct shash_alg *alg)
|
||||
{
|
||||
return crypto_unregister_alg(&alg->base);
|
||||
crypto_unregister_alg(&alg->base);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_unregister_shash);
|
||||
|
||||
|
@ -546,19 +546,12 @@ err:
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_shashes);
|
||||
|
||||
int crypto_unregister_shashes(struct shash_alg *algs, int count)
|
||||
void crypto_unregister_shashes(struct shash_alg *algs, int count)
|
||||
{
|
||||
int i, ret;
|
||||
int i;
|
||||
|
||||
for (i = count - 1; i >= 0; --i) {
|
||||
ret = crypto_unregister_shash(&algs[i]);
|
||||
if (ret)
|
||||
pr_err("Failed to unregister %s %s: %d\n",
|
||||
algs[i].base.cra_driver_name,
|
||||
algs[i].base.cra_name, ret);
|
||||
}
|
||||
|
||||
return 0;
|
||||
for (i = count - 1; i >= 0; --i)
|
||||
crypto_unregister_shash(&algs[i]);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_unregister_shashes);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue