Skip to content

Commit d416559

Browse files
ebiggersherbertx
authored andcommitted
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>
1 parent 2b78aeb commit d416559

11 files changed

Lines changed: 0 additions & 25 deletions

File tree

‎arch/sparc/crypto/aes_glue.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,6 @@ static bool __init sparc64_has_aes_opcode(void)
476476

477477
static int __init aes_sparc64_mod_init(void)
478478
{
479-
int i;
480-
481-
for (i = 0; i < ARRAY_SIZE(algs); i++)
482-
INIT_LIST_HEAD(&algs[i].cra_list);
483-
484479
if (sparc64_has_aes_opcode()) {
485480
pr_info("Using sparc64 aes opcodes optimized AES implementation\n");
486481
return crypto_register_algs(algs, ARRAY_SIZE(algs));

‎arch/sparc/crypto/camellia_glue.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,6 @@ static bool __init sparc64_has_camellia_opcode(void)
299299

300300
static int __init camellia_sparc64_mod_init(void)
301301
{
302-
int i;
303-
304-
for (i = 0; i < ARRAY_SIZE(algs); i++)
305-
INIT_LIST_HEAD(&algs[i].cra_list);
306-
307302
if (sparc64_has_camellia_opcode()) {
308303
pr_info("Using sparc64 camellia opcodes optimized CAMELLIA implementation\n");
309304
return crypto_register_algs(algs, ARRAY_SIZE(algs));

‎arch/sparc/crypto/des_glue.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,6 @@ static bool __init sparc64_has_des_opcode(void)
510510

511511
static int __init des_sparc64_mod_init(void)
512512
{
513-
int i;
514-
515-
for (i = 0; i < ARRAY_SIZE(algs); i++)
516-
INIT_LIST_HEAD(&algs[i].cra_list);
517-
518513
if (sparc64_has_des_opcode()) {
519514
pr_info("Using sparc64 des opcodes optimized DES implementation\n");
520515
return crypto_register_algs(algs, ARRAY_SIZE(algs));

‎crypto/lz4.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ static struct crypto_alg alg_lz4 = {
122122
.cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
123123
.cra_ctxsize = sizeof(struct lz4_ctx),
124124
.cra_module = THIS_MODULE,
125-
.cra_list = LIST_HEAD_INIT(alg_lz4.cra_list),
126125
.cra_init = lz4_init,
127126
.cra_exit = lz4_exit,
128127
.cra_u = { .compress = {

‎crypto/lz4hc.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ static struct crypto_alg alg_lz4hc = {
123123
.cra_flags = CRYPTO_ALG_TYPE_COMPRESS,
124124
.cra_ctxsize = sizeof(struct lz4hc_ctx),
125125
.cra_module = THIS_MODULE,
126-
.cra_list = LIST_HEAD_INIT(alg_lz4hc.cra_list),
127126
.cra_init = lz4hc_init,
128127
.cra_exit = lz4hc_exit,
129128
.cra_u = { .compress = {

‎drivers/crypto/bcm/cipher.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4605,7 +4605,6 @@ static int spu_register_ablkcipher(struct iproc_alg_s *driver_alg)
46054605
crypto->cra_priority = cipher_pri;
46064606
crypto->cra_alignmask = 0;
46074607
crypto->cra_ctxsize = sizeof(struct iproc_ctx_s);
4608-
INIT_LIST_HEAD(&crypto->cra_list);
46094608

46104609
crypto->cra_init = ablkcipher_cra_init;
46114610
crypto->cra_exit = generic_cra_exit;
@@ -4691,7 +4690,6 @@ static int spu_register_aead(struct iproc_alg_s *driver_alg)
46914690
aead->base.cra_priority = aead_pri;
46924691
aead->base.cra_alignmask = 0;
46934692
aead->base.cra_ctxsize = sizeof(struct iproc_ctx_s);
4694-
INIT_LIST_HEAD(&aead->base.cra_list);
46954693

46964694
aead->base.cra_flags |= CRYPTO_ALG_ASYNC;
46974695
/* setkey set in alg initialization */

‎drivers/crypto/omap-aes.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,6 @@ static int omap_aes_probe(struct platform_device *pdev)
12221222
algp = &dd->pdata->algs_info[i].algs_list[j];
12231223

12241224
pr_debug("reg alg: %s\n", algp->cra_name);
1225-
INIT_LIST_HEAD(&algp->cra_list);
12261225

12271226
err = crypto_register_alg(algp);
12281227
if (err)
@@ -1240,7 +1239,6 @@ static int omap_aes_probe(struct platform_device *pdev)
12401239
algp = &aalg->base;
12411240

12421241
pr_debug("reg alg: %s\n", algp->cra_name);
1243-
INIT_LIST_HEAD(&algp->cra_list);
12441242

12451243
err = crypto_register_aead(aalg);
12461244
if (err)

‎drivers/crypto/omap-des.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,6 @@ static int omap_des_probe(struct platform_device *pdev)
10691069
algp = &dd->pdata->algs_info[i].algs_list[j];
10701070

10711071
pr_debug("reg alg: %s\n", algp->cra_name);
1072-
INIT_LIST_HEAD(&algp->cra_list);
10731072

10741073
err = crypto_register_alg(algp);
10751074
if (err)

‎drivers/crypto/qce/ablkcipher.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ static int qce_ablkcipher_register_one(const struct qce_ablkcipher_def *def,
376376
alg->cra_module = THIS_MODULE;
377377
alg->cra_init = qce_ablkcipher_init;
378378
alg->cra_exit = qce_ablkcipher_exit;
379-
INIT_LIST_HEAD(&alg->cra_list);
380379

381380
INIT_LIST_HEAD(&tmpl->entry);
382381
tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_ABLKCIPHER;

‎drivers/crypto/qce/sha.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def,
508508
base->cra_alignmask = 0;
509509
base->cra_module = THIS_MODULE;
510510
base->cra_init = qce_ahash_cra_init;
511-
INIT_LIST_HEAD(&base->cra_list);
512511

513512
snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
514513
snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",

0 commit comments

Comments
 (0)