History

tpm: avoid -Wunused-but-set-variable

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.

Arnd Bergmann committed 2 years ago

Commit 6f1d4d21 parent c424d261 file · +7 −2Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/tpm_eventlog.h+7−2
@@ -131,11 +131,16 @@ struct tcg_algorithm_info { · 130 unmodified lines
131};131};
132 132
133#ifndef TPM_MEMREMAP133#ifndef TPM_MEMREMAP
134#define TPM_MEMREMAP(start, size) NULL134static inline void *TPM_MEMREMAP(unsigned long start, size_t size)
135{
136 return NULL;
137}
135#endif138#endif
136 139
137#ifndef TPM_MEMUNMAP140#ifndef TPM_MEMUNMAP
138#define TPM_MEMUNMAP(start, size) do{} while(0)141static inline void TPM_MEMUNMAP(void *mapping, size_t size)
142{
143}
139#endif144#endif
140 145
141/**146/**