[PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature

Eric Biggers ebiggers at kernel.org
Thu May 27 17:46:25 UTC 2021


On Thu, May 27, 2021 at 07:28:09AM +0100, Austin Kim wrote:
> 
> The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.

What does this mean?  There is no platform_driver involved here at all.

> But ghash_cpu_feature is not used, so remove ghash_cpu_feature.

It is used when the file is built as a module.

> diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> index 720cd3a58da3..c3f27d0d5329 100644
> --- a/arch/arm64/crypto/ghash-ce-glue.c
> +++ b/arch/arm64/crypto/ghash-ce-glue.c
> @@ -615,10 +615,5 @@ static void __exit ghash_ce_mod_exit(void)
>  		crypto_unregister_shash(&ghash_alg);
>  }
>  
> -static const struct cpu_feature ghash_cpu_feature[] = {
> -	{ cpu_feature(PMULL) }, { }
> -};
> -MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
> -

Probably adding __maybe_unused to ghash_cpu_feature[] is the right thing to do.
That's what module_cpu_feature_match() does.

(Note that module_cpu_feature_match() can't be used here, as it seems the intent
is for this module to be autoloaded when PMULL is detected, but still be
loadable without it.  So, that's apparently the reason for using
MODULE_DEVICE_TABLE() directly.)

- Eric



More information about the Linux-security-module-archive mailing list