* [PATCH] tpm: aovid -Wunused-but-set-variable
@ 2024-03-22 13:22 Arnd Bergmann
2026-04-12 23:32 ` Thorsten Blum
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2024-03-22 13:22 UTC (permalink / raw)
To: Jarkko Sakkinen, Matthew Garrett, Bartosz Szczepanek,
Ard Biesheuvel
Cc: Arnd Bergmann, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Outside of the EFI tpm code, the TPM_MEMREMAP()/TPM_MEMUNMAP functions are
defined as trivial macros, leading to the mapping_size variable ending
up unused:
In file included from drivers/char/tpm/tpm-sysfs.c:16:
In file included from drivers/char/tpm/tpm.h:28:
include/linux/tpm_eventlog.h:167:6: error: variable 'mapping_size' set but not used [-Werror,-Wunused-but-set-variable]
167 | int mapping_size;
Turn the stubs into inline functions to avoid this warning.
Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/tpm_eventlog.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
index 7d68a5cc5881..6e5be15029fb 100644
--- a/include/linux/tpm_eventlog.h
+++ b/include/linux/tpm_eventlog.h
@@ -131,11 +131,16 @@ struct tcg_algorithm_info {
};
#ifndef TPM_MEMREMAP
-#define TPM_MEMREMAP(start, size) NULL
+static inline void *TPM_MEMREMAP(unsigned long start, size_t size)
+{
+ return NULL;
+}
#endif
#ifndef TPM_MEMUNMAP
-#define TPM_MEMUNMAP(start, size) do{} while(0)
+static inline void TPM_MEMUNMAP(void *mapping, size_t size)
+{
+}
#endif
/**
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: aovid -Wunused-but-set-variable
2024-03-22 13:22 [PATCH] tpm: aovid -Wunused-but-set-variable Arnd Bergmann
@ 2026-04-12 23:32 ` Thorsten Blum
2026-04-15 2:48 ` Jarkko Sakkinen
0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2026-04-12 23:32 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jarkko Sakkinen, Matthew Garrett, Bartosz Szczepanek,
Ard Biesheuvel, Arnd Bergmann, Peter Huewe, Jason Gunthorpe,
linux-integrity, linux-kernel
On Fri, Mar 22, 2024 at 02:22:48PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Outside of the EFI tpm code, the TPM_MEMREMAP()/TPM_MEMUNMAP functions are
> defined as trivial macros, leading to the mapping_size variable ending
> up unused:
>
> In file included from drivers/char/tpm/tpm-sysfs.c:16:
> In file included from drivers/char/tpm/tpm.h:28:
> include/linux/tpm_eventlog.h:167:6: error: variable 'mapping_size' set but not used [-Werror,-Wunused-but-set-variable]
> 167 | int mapping_size;
>
> Turn the stubs into inline functions to avoid this warning.
>
> Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> include/linux/tpm_eventlog.h | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
> index 7d68a5cc5881..6e5be15029fb 100644
> --- a/include/linux/tpm_eventlog.h
> +++ b/include/linux/tpm_eventlog.h
> @@ -131,11 +131,16 @@ struct tcg_algorithm_info {
> };
>
> #ifndef TPM_MEMREMAP
> -#define TPM_MEMREMAP(start, size) NULL
> +static inline void *TPM_MEMREMAP(unsigned long start, size_t size)
> +{
> + return NULL;
> +}
> #endif
>
> #ifndef TPM_MEMUNMAP
> -#define TPM_MEMUNMAP(start, size) do{} while(0)
> +static inline void TPM_MEMUNMAP(void *mapping, size_t size)
> +{
> +}
> #endif
>
> /**
I just stumbled upon the same problem and found this patch from 2024,
which still applies. I cc'ed the current maintainers - maybe someone can
pick this up? Thanks!
Reviewed-by: Thorsten Blum <thorsten.blum@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: aovid -Wunused-but-set-variable
2026-04-12 23:32 ` Thorsten Blum
@ 2026-04-15 2:48 ` Jarkko Sakkinen
0 siblings, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2026-04-15 2:48 UTC (permalink / raw)
To: Thorsten Blum
Cc: Arnd Bergmann, Matthew Garrett, Bartosz Szczepanek,
Ard Biesheuvel, Arnd Bergmann, Peter Huewe, Jason Gunthorpe,
linux-integrity, linux-kernel
On Mon, Apr 13, 2026 at 01:32:48AM +0200, Thorsten Blum wrote:
> On Fri, Mar 22, 2024 at 02:22:48PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > Outside of the EFI tpm code, the TPM_MEMREMAP()/TPM_MEMUNMAP functions are
> > defined as trivial macros, leading to the mapping_size variable ending
> > up unused:
> >
> > In file included from drivers/char/tpm/tpm-sysfs.c:16:
> > In file included from drivers/char/tpm/tpm.h:28:
> > include/linux/tpm_eventlog.h:167:6: error: variable 'mapping_size' set but not used [-Werror,-Wunused-but-set-variable]
> > 167 | int mapping_size;
> >
> > Turn the stubs into inline functions to avoid this warning.
> >
> > Fixes: c46f3405692d ("tpm: Reserve the TPM final events table")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > include/linux/tpm_eventlog.h | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
> > index 7d68a5cc5881..6e5be15029fb 100644
> > --- a/include/linux/tpm_eventlog.h
> > +++ b/include/linux/tpm_eventlog.h
> > @@ -131,11 +131,16 @@ struct tcg_algorithm_info {
> > };
> >
> > #ifndef TPM_MEMREMAP
> > -#define TPM_MEMREMAP(start, size) NULL
> > +static inline void *TPM_MEMREMAP(unsigned long start, size_t size)
> > +{
> > + return NULL;
> > +}
> > #endif
> >
> > #ifndef TPM_MEMUNMAP
> > -#define TPM_MEMUNMAP(start, size) do{} while(0)
> > +static inline void TPM_MEMUNMAP(void *mapping, size_t size)
> > +{
> > +}
> > #endif
> >
> > /**
>
> I just stumbled upon the same problem and found this patch from 2024,
> which still applies. I cc'ed the current maintainers - maybe someone can
> pick this up? Thanks!
>
> Reviewed-by: Thorsten Blum <thorsten.blum@linux.dev>
Thanks.
Arnd, I fixed typo in short summary and applied with that modification.
BR, Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-15 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-22 13:22 [PATCH] tpm: aovid -Wunused-but-set-variable Arnd Bergmann
2026-04-12 23:32 ` Thorsten Blum
2026-04-15 2:48 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox