From: Arnd Bergmann Date: Thu, 4 Dec 2025 10:28:59 +0000 (+0100) Subject: mm: shmem: avoid build warning for CONFIG_SHMEM=n X-Git-Tag: v6.19-rc1~8^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=402736a591b040360d36cfc27f6c371103177641;p=thirdparty%2Flinux.git mm: shmem: avoid build warning for CONFIG_SHMEM=n The newly added 'flags' variable is unused and causes a warning if CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed into does nothing: mm/shmem.c: In function '__shmem_file_setup': mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable] 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0; | ^~~~~ Replace the two macros with equivalent inline functions to get the argument checking. Link: https://lkml.kernel.org/r/20251204102905.1048000-1-arnd@kernel.org Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags") Signed-off-by: Arnd Bergmann Acked-by: David Hildenbrand (Red Hat) Acked-by: Mike Rapoport (Microsoft) Reviewed-by: Baolin Wang Reviewed-by: Pratyush Yadav Reviewed-by: Pasha Tatashin Cc: Christian Brauner Cc: guoweikang Cc: Hugh Dickins Cc: Kairui Song Cc: Kemeng Shi Cc: Lorenzo Stoakes Signed-off-by: Andrew Morton --- diff --git a/mm/shmem.c b/mm/shmem.c index 679721e48a872..3c0601d763174 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -5799,8 +5799,15 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); #define shmem_vm_ops generic_file_vm_ops #define shmem_anon_vm_ops generic_file_vm_ops #define shmem_file_operations ramfs_file_operations -#define shmem_acct_size(flags, size) 0 -#define shmem_unacct_size(flags, size) do {} while (0) + +static inline int shmem_acct_size(unsigned long flags, loff_t size) +{ + return 0; +} + +static inline void shmem_unacct_size(unsigned long flags, loff_t size) +{ +} static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block *sb, struct inode *dir,