crypto: remove useless initializations of cra_list
authorEric Biggers <ebiggers@google.com>
Wed, 14 Nov 2018 19:35:48 +0000 (11:35 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 20 Nov 2018 06:26:55 +0000 (14:26 +0800)
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>
arch/sparc/crypto/aes_glue.c
arch/sparc/crypto/camellia_glue.c
arch/sparc/crypto/des_glue.c
crypto/lz4.c
crypto/lz4hc.c
drivers/crypto/bcm/cipher.c
drivers/crypto/omap-aes.c
drivers/crypto/omap-des.c
drivers/crypto/qce/ablkcipher.c
drivers/crypto/qce/sha.c
drivers/crypto/sahara.c

index 3cd4f6b198b65665046101184f579b51138a688d..a9b8b0b94a8d4201cbc44a4c271733e739288d78 100644 (file)
@@ -476,11 +476,6 @@ static bool __init sparc64_has_aes_opcode(void)
 
 static int __init aes_sparc64_mod_init(void)
 {
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(algs); i++)
-               INIT_LIST_HEAD(&algs[i].cra_list);
-
        if (sparc64_has_aes_opcode()) {
                pr_info("Using sparc64 aes opcodes optimized AES implementation\n");
                return crypto_register_algs(algs, ARRAY_SIZE(algs));
index 561a84d93cf682a400a7555862f065f1fb04c84c..900d5c617e83b53de0892b35ee942c4e3cb7a8bf 100644 (file)
@@ -299,11 +299,6 @@ static bool __init sparc64_has_camellia_opcode(void)
 
 static int __init camellia_sparc64_mod_init(void)
 {
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(algs); i++)
-               INIT_LIST_HEAD(&algs[i].cra_list);
-
        if (sparc64_has_camellia_opcode()) {
                pr_info("Using sparc64 camellia opcodes optimized CAMELLIA implementation\n");
                return crypto_register_algs(algs, ARRAY_SIZE(algs));
index 61af794aa2d31d5df27d0a318ac8b8f9d605637b..56499ea39fd36d5358981fcd1afafdb6d03b9471 100644 (file)
@@ -510,11 +510,6 @@ static bool __init sparc64_has_des_opcode(void)
 
 static int __init des_sparc64_mod_init(void)
 {
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(algs); i++)
-               INIT_LIST_HEAD(&algs[i].cra_list);
-
        if (sparc64_has_des_opcode()) {
                pr_info("Using sparc64 des opcodes optimized DES implementation\n");
                return crypto_register_algs(algs, ARRAY_SIZE(algs));
index 2ce2660d3519ef3fab4a70f74ea1c5dd30f12e0e..c160dfdbf2e0767691a4b2d157bffc3396e7b0fb 100644 (file)
@@ -122,7 +122,6 @@ static struct crypto_alg alg_lz4 = {
        .cra_flags              = CRYPTO_ALG_TYPE_COMPRESS,
        .cra_ctxsize            = sizeof(struct lz4_ctx),
        .cra_module             = THIS_MODULE,
-       .cra_list               = LIST_HEAD_INIT(alg_lz4.cra_list),
        .cra_init               = lz4_init,
        .cra_exit               = lz4_exit,
        .cra_u                  = { .compress = {
index 2be14f054dafda9b7f46cb21e5a5175ee688dacc..583b5e013d7a59f63b5fab2e4ccf7cabc7b77c3a 100644 (file)
@@ -123,7 +123,6 @@ static struct crypto_alg alg_lz4hc = {
        .cra_flags              = CRYPTO_ALG_TYPE_COMPRESS,
        .cra_ctxsize            = sizeof(struct lz4hc_ctx),
        .cra_module             = THIS_MODULE,
-       .cra_list               = LIST_HEAD_INIT(alg_lz4hc.cra_list),
        .cra_init               = lz4hc_init,
        .cra_exit               = lz4hc_exit,
        .cra_u                  = { .compress = {
index 4d67e22a466446d7a3a555dffe5325ab35b7355e..2ce3a16d3d10f0c51a566b8d6a981abf86c4c6a3 100644 (file)
@@ -4605,7 +4605,6 @@ static int spu_register_ablkcipher(struct iproc_alg_s *driver_alg)
        crypto->cra_priority = cipher_pri;
        crypto->cra_alignmask = 0;
        crypto->cra_ctxsize = sizeof(struct iproc_ctx_s);
-       INIT_LIST_HEAD(&crypto->cra_list);
 
        crypto->cra_init = ablkcipher_cra_init;
        crypto->cra_exit = generic_cra_exit;
@@ -4691,7 +4690,6 @@ static int spu_register_aead(struct iproc_alg_s *driver_alg)
        aead->base.cra_priority = aead_pri;
        aead->base.cra_alignmask = 0;
        aead->base.cra_ctxsize = sizeof(struct iproc_ctx_s);
-       INIT_LIST_HEAD(&aead->base.cra_list);
 
        aead->base.cra_flags |= CRYPTO_ALG_ASYNC;
        /* setkey set in alg initialization */
index a553ffddb11beed2f5ed335e18cdd9ebfb6546e7..4c0ea8142923258befe28046b60862f350ffa5c1 100644 (file)
@@ -1222,7 +1222,6 @@ static int omap_aes_probe(struct platform_device *pdev)
                                algp = &dd->pdata->algs_info[i].algs_list[j];
 
                                pr_debug("reg alg: %s\n", algp->cra_name);
-                               INIT_LIST_HEAD(&algp->cra_list);
 
                                err = crypto_register_alg(algp);
                                if (err)
@@ -1240,7 +1239,6 @@ static int omap_aes_probe(struct platform_device *pdev)
                        algp = &aalg->base;
 
                        pr_debug("reg alg: %s\n", algp->cra_name);
-                       INIT_LIST_HEAD(&algp->cra_list);
 
                        err = crypto_register_aead(aalg);
                        if (err)
index eb95b0d7f1846f67418a2115c9dff185174843d8..6369019219d4431ec53131f1565af8f046fc49e1 100644 (file)
@@ -1069,7 +1069,6 @@ static int omap_des_probe(struct platform_device *pdev)
                        algp = &dd->pdata->algs_info[i].algs_list[j];
 
                        pr_debug("reg alg: %s\n", algp->cra_name);
-                       INIT_LIST_HEAD(&algp->cra_list);
 
                        err = crypto_register_alg(algp);
                        if (err)
index 585e1cab9ae347ec8b637f9d02f824328d61dc1f..25c13e26d01287c0bfdce32d8707a72bb0a068c8 100644 (file)
@@ -376,7 +376,6 @@ static int qce_ablkcipher_register_one(const struct qce_ablkcipher_def *def,
        alg->cra_module = THIS_MODULE;
        alg->cra_init = qce_ablkcipher_init;
        alg->cra_exit = qce_ablkcipher_exit;
-       INIT_LIST_HEAD(&alg->cra_list);
 
        INIT_LIST_HEAD(&tmpl->entry);
        tmpl->crypto_alg_type = CRYPTO_ALG_TYPE_ABLKCIPHER;
index d8a5db11b7ea1f3b3fec471b2cca1e11a84d6d1e..fc45f5ea6fdd272487009e6ce48c38379b63634d 100644 (file)
@@ -508,7 +508,6 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def,
        base->cra_alignmask = 0;
        base->cra_module = THIS_MODULE;
        base->cra_init = qce_ahash_cra_init;
-       INIT_LIST_HEAD(&base->cra_list);
 
        snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
        snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
index bbf166a97ad3a345aa33b30af1566cb38ce86ad8..8c32a3059b4a8cf87ec16687ca1b8ac6629d902e 100644 (file)
@@ -1321,7 +1321,6 @@ static int sahara_register_algs(struct sahara_dev *dev)
        unsigned int i, j, k, l;
 
        for (i = 0; i < ARRAY_SIZE(aes_algs); i++) {
-               INIT_LIST_HEAD(&aes_algs[i].cra_list);
                err = crypto_register_alg(&aes_algs[i]);
                if (err)
                        goto err_aes_algs;