[PATCH] tpm: Make tcpci_pm_ops variable static const

Krzysztof Kozlowski posted 1 patch 1 month ago
drivers/char/tpm/tpm2-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tpm: Make tcpci_pm_ops variable static const
Posted by Krzysztof Kozlowski 1 month ago
File-scope 'tcpci_pm_ops' is not used outside of this unit and is not
modified anywhere, so make it static const to silence sparse warning:

  tcpci.c:1002:1: warning: symbol 'tcpci_pm_ops' was not declared. Should it be static?

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/char/tpm/tpm2-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 3a77be7ebf4a..e00f668f8c84 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -21,7 +21,7 @@ static bool disable_pcr_integrity;
 module_param(disable_pcr_integrity, bool, 0444);
 MODULE_PARM_DESC(disable_pcr_integrity, "Disable integrity protection of TPM2_PCR_Extend");
 
-struct tpm2_hash tpm2_hash_map[] = {
+static const struct tpm2_hash tpm2_hash_map[] = {
 	{HASH_ALGO_SHA1, TPM_ALG_SHA1},
 	{HASH_ALGO_SHA256, TPM_ALG_SHA256},
 	{HASH_ALGO_SHA384, TPM_ALG_SHA384},
-- 
2.51.0
Re: [PATCH] tpm: Make tcpci_pm_ops variable static const
Posted by Jarkko Sakkinen 2 weeks, 1 day ago
On Mon, Feb 16, 2026 at 12:04:59PM +0100, Krzysztof Kozlowski wrote:
> File-scope 'tcpci_pm_ops' is not used outside of this unit and is not
> modified anywhere, so make it static const to silence sparse warning:
> 
>   tcpci.c:1002:1: warning: symbol 'tcpci_pm_ops' was not declared. Should it be static?
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>  drivers/char/tpm/tpm2-cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index 3a77be7ebf4a..e00f668f8c84 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -21,7 +21,7 @@ static bool disable_pcr_integrity;
>  module_param(disable_pcr_integrity, bool, 0444);
>  MODULE_PARM_DESC(disable_pcr_integrity, "Disable integrity protection of TPM2_PCR_Extend");
>  
> -struct tpm2_hash tpm2_hash_map[] = {
> +static const struct tpm2_hash tpm2_hash_map[] = {
>  	{HASH_ALGO_SHA1, TPM_ALG_SHA1},
>  	{HASH_ALGO_SHA256, TPM_ALG_SHA256},
>  	{HASH_ALGO_SHA384, TPM_ALG_SHA384},
> -- 
> 2.51.0
> 

Applied.

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko