crypto: img-hash - Use unregister_ahashes in img_{un}register_algs
PATCH 1/1 crypto: img-hash - Use unregister_ahashes in img_{un}register_algs
Replace the for loops with calls to crypto_unregister_ahashes(). In img_register_algs(), return 'err' immediately and remove the goto statement to simplify the error handling code.
Convert img_unregister_algs() to a void function since its return value is never used.
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/crypto/img-hash.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/crypto/img-hash.c +7 -14
@@ -870,25 +870,18 @@ static int img_register_algs(struct img_hash_dev *hdev)for (i =0 ; i <ARRAY_SIZE (img_algs); i++) { err =crypto_register_ahash (&img_algs[i]); -if (err) - goto err_reg; +if (err) { +crypto_unregister_ahashes (img_algs, i); +return err; + } } -return 0 ; -err_reg: -for (; i--; ) -crypto_unregister_ahash (&img_algs[i]); - -return err; +return 0 ; } -static int img_unregister_algs (struct img_hash_dev *hdev) +static void img_unregister_algs (struct img_hash_dev *hdev) { -int i; - -for (i =0 ; i <ARRAY_SIZE (img_algs); i++) -crypto_unregister_ahash (&img_algs[i]); -return 0 ; +crypto_unregister_ahashes (img_algs,ARRAY_SIZE (img_algs)); }static void img_hash_done_task (unsigned long data)
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Herbert Xu
maintainerQuoted 11 lines · Thorsten Blum
Replace the for loops with calls to
crypto_unregister_ahashes(). Inimg_register_algs(), return 'err' immediately and remove the goto statement to simplify the error handling code.Convert
img_unregister_algs()to a void function since its return value is never used.Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/img-hash.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt