:p
atchew
Login
When build with !CONFIG_MMU, the variable 'vmcore_mmap_ops' is defined but not used: >> fs/proc/vmcore.c:458:42: warning: unused variable 'vmcore_mmap_ops' 458 | static const struct vm_operations_struct vmcore_mmap_ops = { Fix this by declaring it __maybe_unused. Fixes: 9cb218131de1 ("vmcore: introduce remap_oldmem_pfn_range()") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/lkml/202410301936.GcE8yUos-lkp@intel.com/ Signed-off-by: Qi Xi <xiqi2@huawei.com> --- fs/proc/vmcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index XXXXXXX..XXXXXXX 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -XXX,XX +XXX,XX @@ static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf) #endif } -static const struct vm_operations_struct vmcore_mmap_ops = { +static const struct vm_operations_struct __maybe_unused vmcore_mmap_ops = { .fault = mmap_vmcore_fault, }; -- 2.33.0
When build with !CONFIG_MMU, the variable 'vmcore_mmap_ops' is defined but not used: >> fs/proc/vmcore.c:458:42: warning: unused variable 'vmcore_mmap_ops' 458 | static const struct vm_operations_struct vmcore_mmap_ops = { Fix this by only defining it when CONFIG_MMU is enabled. Fixes: 9cb218131de1 ("vmcore: introduce remap_oldmem_pfn_range()") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/lkml/202410301936.GcE8yUos-lkp@intel.com/ Signed-off-by: Qi Xi <xiqi2@huawei.com> --- v3: move changelogs after the '---' line v2: use ifdef instead of __maybe_unused fs/proc/vmcore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index XXXXXXX..XXXXXXX 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -XXX,XX +XXX,XX @@ static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf) #endif } -static const struct vm_operations_struct vmcore_mmap_ops = { - .fault = mmap_vmcore_fault, -}; - /** * vmcore_alloc_buf - allocate buffer in vmalloc memory * @size: size of buffer @@ -XXX,XX +XXX,XX @@ static inline char *vmcore_alloc_buf(size_t size) * virtually contiguous user-space in ELF layout. */ #ifdef CONFIG_MMU + +static const struct vm_operations_struct vmcore_mmap_ops = { + .fault = mmap_vmcore_fault, +}; + /* * remap_oldmem_pfn_checked - do remap_oldmem_pfn_range replacing all pages * reported as not being ram with the zero page. -- 2.33.0