Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
From: Mike Rapoport
Date: Thu Dec 04 2025 - 05:55:47 EST
On Thu, Dec 04, 2025 at 11:28:59AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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 tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> v2: make shmem_unacct_size() inline as well.
--
Sincerely yours,
Mike.