crypto: qce - simplify control flow in register functions
Subsystems (3)
PATCH 1/1 crypto: qce - simplify control flow in register functions
Remove the goto statements and handle errors directly to simplify the control flow in qce_aead_register(), qce_ahash_register(), and qce_skcipher_register().
Signed-off-by Thorsten Blum <[email protected]>
--- drivers/crypto/qce/aead.c | 9 ++++----- drivers/crypto/qce/sha.c | 9 ++++----- drivers/crypto/qce/skcipher.c | 9 ++++----- 3 files changed, 12 insertions(+), 15 deletions(-)
drivers/crypto/qce/aead.c +4 -5
@@ -829,14 +829,13 @@ static int qce_aead_register(struct qce_device *qce)for (i =0 ; i <ARRAY_SIZE (aead_def); i++) { ret =qce_aead_register_one (&aead_def[i], qce); -if (ret) - goto err; +if (ret) { +qce_aead_unregister (qce); +return ret; + } }return 0 ; -err: -qce_aead_unregister (qce); -return ret; }const struct qce_algo_ops aead_ops = {
drivers/crypto/qce/sha.c +4 -5
@@ -527,14 +527,13 @@ static int qce_ahash_register(struct qce_device *qce)for (i =0 ; i <ARRAY_SIZE (ahash_def); i++) { ret =qce_ahash_register_one (&ahash_def[i], qce); -if (ret) - goto err; +if (ret) { +qce_ahash_unregister (qce); +return ret; + } }return 0 ; -err: -qce_ahash_unregister (qce); -return ret; }const struct qce_algo_ops ahash_ops = {
drivers/crypto/qce/skcipher.c +4 -5
@@ -511,14 +511,13 @@ static int qce_skcipher_register(struct qce_device *qce)for (i =0 ; i <ARRAY_SIZE (skcipher_def); i++) { ret =qce_skcipher_register_one (&skcipher_def[i], qce); -if (ret) - goto err; +if (ret) { +qce_skcipher_unregister (qce); +return ret; + } }return 0 ; -err: -qce_skcipher_unregister (qce); -return ret; }const struct qce_algo_ops skcipher_ops = {
Quoted 6 lines · Thorsten Blum
Remove the goto statements and handle errors directly to simplify the control flow in
qce_aead_register(),qce_ahash_register(), andqce_skcipher_register().Signed-off-by Thorsten Blum <[email protected]>---
Reviewed-by Bartosz Golaszewski <[email protected]>
Herbert Xu
maintainerQuoted 10 lines · Thorsten Blum
Remove the goto statements and handle errors directly to simplify the control flow in
qce_aead_register(),qce_ahash_register(), andqce_skcipher_register().Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/qce/aead.c | 9 ++++----- drivers/crypto/qce/sha.c | 9 ++++----- drivers/crypto/qce/skcipher.c | 9 ++++----- 3 files changed, 12 insertions(+), 15 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