Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: remove useless initializations of cra_list

Some algorithms initialize their .cra_list prior to registration.
But this is unnecessary since crypto_register_alg() will overwrite
.cra_list when adding the algorithm to the 'crypto_alg_list'.
Apparently the useless assignment has just been copy+pasted around.

So, remove the useless assignments.

Exception: paes_s390.c uses cra_list to check whether the algorithm is
registered or not, so I left that as-is for now.

This patch shouldn't change any actual behavior.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
d4165590 2b78aeb3

-25
-5
arch/sparc/crypto/aes_glue.c
··· 476 476 477 477 static int __init aes_sparc64_mod_init(void) 478 478 { 479 - int i; 480 - 481 - for (i = 0; i < ARRAY_SIZE(algs); i++) 482 - INIT_LIST_HEAD(&algs[i].cra_list); 483 - 484 479 if (sparc64_has_aes_opcode()) { 485 480 pr_info("Using sparc64 aes opcodes optimized AES implementation\n"); 486 481 return crypto_register_algs(algs, ARRAY_SIZE(algs));
-5
arch/sparc/crypto/camellia_glue.c
··· 299 299 300 300 static int __init camellia_sparc64_mod_init(void) 301 301 { 302 - int i; 303 - 304 - for (i = 0; i < ARRAY_SIZE(algs); i++) 305 - INIT_LIST_HEAD(&algs[i].cra_list); 306 - 307 302 if (sparc64_has_camellia_opcode()) { 308 303 pr_info("Using sparc64 camellia opcodes optimized CAMELLIA implementation\n"); 309 304 return crypto_register_algs(algs, ARRAY_SIZE(algs));
-5
arch/sparc/crypto/des_glue.c
··· 510 510 511 511 static int __init des_sparc64_mod_init(void) 512 512 { 513 - int i; 514 - 515 - for (i = 0; i < ARRAY_SIZE(algs); i++) 516 - INIT_LIST_HEAD(&algs[i].cra_list); 517 - 518 513 if (sparc64_has_des_opcode()) { 519 514 pr_info("Using sparc64 des opcodes optimized DES implementation\n"); 520 515 return crypto_register_algs(algs, ARRAY_SIZE(algs));
-1
crypto/lz4.c
··· 122 122 .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, 123 123 .cra_ctxsize = sizeof(struct lz4_ctx), 124 124 .cra_module = THIS_MODULE, 125 - .cra_list = LIST_HEAD_INIT(alg_lz4.cra_list), 126 125 .cra_init = lz4_init, 127 126 .cra_exit = lz4_exit, 128 127 .cra_u = { .compress = {
-1
crypto/lz4hc.c
··· 123 123 .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, 124 124 .cra_ctxsize = sizeof(struct lz4hc_ctx), 125 125 .cra_module = THIS_MODULE, 126 - .cra_list = LIST_HEAD_INIT(alg_lz4hc.cra_list), 127 126 .cra_init = lz4hc_init, 128 127 .cra_exit = lz4hc_exit, 129 128 .cra_u = { .compress = {
-2
drivers/crypto/bcm/cipher.c
··· 4605 4605 crypto->cra_priority = cipher_pri; 4606 4606 crypto->cra_alignmask = 0; 4607 4607 crypto->cra_ctxsize = sizeof(struct iproc_ctx_s); 4608 - INIT_LIST_HEAD(&crypto->cra_list); 4609 4608 4610 4609 crypto->cra_init = ablkcipher_cra_init; 4611 4610 crypto->cra_exit = generic_cra_exit; ··· 4690 4691 aead->base.cra_priority = aead_pri; 4691 4692 aead->base.cra_alignmask = 0; 4692 4693 aead->base.cra_ctxsize = sizeof(struct iproc_ctx_s); 4693 - INIT_LIST_HEAD(&aead->base.cra_list); 4694 4694 4695 4695 aead->base.cra_flags |= CRYPTO_ALG_ASYNC; 4696 4696 /* setkey set in alg initialization */
-2
drivers/crypto/omap-aes.c
··· 1222 1222 algp = &dd->pdata->algs_info[i].algs_list[j]; 1223 1223 1224 1224 pr_debug("reg alg: %s\n", algp->cra_name); 1225 - INIT_LIST_HEAD(&algp->cra_list); 1226 1225 1227 1226 err = crypto_register_alg(algp); 1228 1227 if (err) ··· 1239 1240 algp = &aalg->base; 1240 1241 1241 1242 pr_debug("reg alg: %s\n", algp->cra_name); 1242 - INIT_LIST_HEAD(&algp->cra_list); 1243 1243 1244 1244 err = crypto_register_aead(aalg); 1245 1245 if (err)
-1
drivers/crypto/omap-des.c
··· 1069 1069 algp = &dd->pdata->algs_info[i].algs_list[j]; 1070 1070 1071 1071 pr_debug("reg alg: %s\n", algp->cra_name); 1072 - INIT_LIST_HEAD(&algp->cra_list); 1073 1072 1074 1073 err = crypto_register_alg(algp); 1075 1074 if (err)
-1
drivers/crypto/qce/ablkcipher.c
··· 376 376 alg->cra_module = THIS_MODULE; 377 377 alg->cra_init = qce_ablkcipher_init; 378 378 alg->cra_exit = qce_ablkcipher_exit; 379 - INIT_LIST_HEAD(&alg->cra_list); 380 379 381 380 INIT_LIST_HEAD(&tmpl->entry); 382 381 tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_ABLKCIPHER;
-1
drivers/crypto/qce/sha.c
··· 508 508 base->cra_alignmask = 0; 509 509 base->cra_module = THIS_MODULE; 510 510 base->cra_init = qce_ahash_cra_init; 511 - INIT_LIST_HEAD(&base->cra_list); 512 511 513 512 snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); 514 513 snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
-1
drivers/crypto/sahara.c
··· 1321 1321 unsigned int i, j, k, l; 1322 1322 1323 1323 for (i = 0; i < ARRAY_SIZE(aes_algs); i++) { 1324 - INIT_LIST_HEAD(&aes_algs[i].cra_list); 1325 1324 err = crypto_register_alg(&aes_algs[i]); 1326 1325 if (err) 1327 1326 goto err_aes_algs;