crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps
PATCH 1/1 crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps
Define crypto_unregister_scomps() before crypto_register_scomps() and replace the for loop with a call to crypto_unregister_scomps(). 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/scompress.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
crypto/scompress.c +13 -17
@@ -377,34 +377,30 @@ void crypto_unregister_scomp(struct scomp_alg *alg) }EXPORT_SYMBOL_GPL (crypto_unregister_scomp); +void crypto_unregister_scomps (struct scomp_alg *algs,int count) +{ +int i; + +for (i = count -1 ; i >=0 ; --i) +crypto_unregister_scomp (&algs[i]); +} +EXPORT_SYMBOL_GPL (crypto_unregister_scomps); +int crypto_register_scomps (struct scomp_alg *algs,int count) {int i, ret;for (i =0 ; i < count; i++) { ret =crypto_register_scomp (&algs[i]); -if (ret) - goto err; +if (ret) { +crypto_unregister_scomps (algs, i); +return ret; + } }return 0 ; - -err: -for (--i; i >=0 ; --i) -crypto_unregister_scomp (&algs[i]); - -return ret; }EXPORT_SYMBOL_GPL (crypto_register_scomps); -void crypto_unregister_scomps (struct scomp_alg *algs,int count) -{ -int i; - -for (i = count -1 ; i >=0 ; --i) -crypto_unregister_scomp (&algs[i]); -} -EXPORT_SYMBOL_GPL (crypto_unregister_scomps); -MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Synchronous compression type" );
Signature · 2 lines
Thorsten Blum <[email protected]> GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Herbert Xu
maintainerQuoted 16 lines · Thorsten Blum
Define
crypto_unregister_scomps()beforecrypto_register_scomps()and replace the for loop with a call tocrypto_unregister_scomps(). 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/scompress.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)crypto/scompress.c +0
-0@@ -377,34 +377,30 @@ void crypto_unregister_scomp(struct scomp_alg *alg) }
crypto/scompress.c void crypto_unregister_scomp(struct scomp_alg *alg) · line 387
Quoted 10 lines
crypto/scompress.c +8
-0EXPORT_SYMBOL_GPL (crypto_unregister_scomp); +void crypto_unregister_scomps (struct scomp_alg *algs,int count) +{ +int i; + +for (i = count -1 ; i >=0 ; --i) +crypto_unregister_scomp (&algs[i]); +} +EXPORT_SYMBOL_GPL (crypto_unregister_scomps);
There is no need to move this function.
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