crypto: algboss - compile out test-related code when tests disabled
authorEric Biggers <ebiggers@google.com>
Mon, 14 Nov 2022 00:12:38 +0000 (16:12 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 25 Nov 2022 09:39:18 +0000 (17:39 +0800)
When CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is set, the code in algboss.c
that handles CRYPTO_MSG_ALG_REGISTER is unnecessary, so make it be
compiled out.

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

index 13d37320a66eb3db191425c7f5467a7902ae1f35..0de1e66979498eb3b49b3862c37879e619fa0f68 100644 (file)
@@ -175,11 +175,7 @@ static int cryptomgr_test(void *data)
 {
        struct crypto_test_param *param = data;
        u32 type = param->type;
-       int err = 0;
-
-#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
-       goto skiptest;
-#endif
+       int err;
 
        err = alg_test(param->driver, param->alg, type, CRYPTO_ALG_TESTED);
 
@@ -194,6 +190,9 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
        struct task_struct *thread;
        struct crypto_test_param *param;
 
+       if (IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS))
+               return NOTIFY_DONE;
+
        if (!try_module_get(THIS_MODULE))
                goto err;