crypto: acomp - Use unregister_acomps in register_acomps
PATCH 1/6 crypto: acomp - Use unregister_acomps in register_acomps
Replace the for loop with a call to crypto_unregister_acomps(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.
--- crypto/acompress.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
crypto/acompress.c +4 -8
@@ -337,17 +337,13 @@ int crypto_register_acomps(struct acomp_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_register_acomp (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_acomps (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_acomp (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_acomps);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
PATCH 2/6 crypto: ahash - Use unregister_ahashes in register_ahashes
Replace the for loop with a call to crypto_unregister_ahashes(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.
--- crypto/ahash.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
crypto/ahash.c +4 -8
@@ -1020,17 +1020,13 @@ int crypto_register_ahashes(struct ahash_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_register_ahash (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_ahashes (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_ahash (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_ahashes);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
PATCH 3/6 crypto: shash - Use unregister_shashes in register_shashes
In reply to Thorsten BlumReplace the for loop with a call to crypto_unregister_shashes(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.
--- crypto/shash.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
crypto/shash.c +4 -8
@@ -542,17 +542,13 @@ int crypto_register_shashes(struct shash_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_register_shash (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_shashes (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_shash (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_shashes);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
PATCH 4/6 crypto: skcipher - Use unregister_skciphers in register_skciphers
In reply to Thorsten BlumReplace the for loop with a call to crypto_unregister_skciphers(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.
--- crypto/skcipher.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
crypto/skcipher.c +4 -8
@@ -741,17 +741,13 @@ int crypto_register_skciphers(struct skcipher_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_register_skcipher (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_skciphers (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_skcipher (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_skciphers);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
PATCH 5/6 crypto: lskcipher - Use unregister_lskciphers in register_lskciphers
In reply to Thorsten BlumReplace the for loop with a call to crypto_unregister_lskciphers(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.
--- crypto/lskcipher.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
crypto/lskcipher.c +4 -8
@@ -384,17 +384,13 @@ int crypto_register_lskciphers(struct lskcipher_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_register_lskcipher (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_lskciphers (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_lskcipher (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_lskciphers);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
PATCH 6/6 crypto: engine - Use unregister_* in register_{aeads,ahashes,skciphers}
In reply to Thorsten BlumReplace the for loops with calls to unregister_aeads(), unregister_ahashes(), and unregister_skciphers(), respectively. Return 'ret' immediately and remove the goto statements to simplify the error handling code. No functional changes.
--- crypto/crypto_engine.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
crypto/crypto_engine.c +12 -21
@@ -524,16 +524,13 @@ int crypto_engine_register_aeads(struct aead_engine_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_engine_register_aead (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_engine_unregister_aeads (algs, i); +return ret; + } }return 0 ; - -err: -crypto_engine_unregister_aeads (algs, i); - -return ret; }EXPORT_SYMBOL_GPL (crypto_engine_register_aeads);
@@ -566,16 +563,13 @@ int crypto_engine_register_ahashes(struct ahash_engine_alg *algs, int count)for (i =0 ; i < count; i++) { ret =crypto_engine_register_ahash (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_engine_unregister_ahashes (algs, i); +return ret; + } }return 0 ; - -err: -crypto_engine_unregister_ahashes (algs, i); - -return ret; }EXPORT_SYMBOL_GPL (crypto_engine_register_ahashes);
@@ -638,16 +632,13 @@ int crypto_engine_register_skciphers(struct skcipher_engine_alg *algs,for (i =0 ; i < count; i++) { ret =crypto_engine_register_skcipher (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_engine_unregister_skciphers (algs, i); +return ret; + } }return 0 ; - -err: -crypto_engine_unregister_skciphers (algs, i); - -return ret; }EXPORT_SYMBOL_GPL (crypto_engine_register_skciphers);
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Herbert Xu
maintainerQuoted 8 lines · Thorsten Blum
Replace the for loop with a call to
crypto_unregister_acomps(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes.Signed-off-by Thorsten Blum <[email protected]>--- crypto/acompress.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
All 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