Skip to content

Commit b8ee299

Browse files
Qi Xiakpm00
authored andcommitted
fs/proc: fix compile warning about variable 'vmcore_mmap_ops'
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. Link: https://lkml.kernel.org/r/20241101034803.9298-1-xiqi2@huawei.com Fixes: 9cb2181 ("vmcore: introduce remap_oldmem_pfn_range()") Signed-off-by: Qi Xi <xiqi2@huawei.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/lkml/202410301936.GcE8yUos-lkp@intel.com/ Cc: Baoquan He <bhe@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Wang ShaoBo <bobo.shaobowang@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 432dc06 commit b8ee299

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/proc/vmcore.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,6 @@ static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
457457
#endif
458458
}
459459

460-
static const struct vm_operations_struct vmcore_mmap_ops = {
461-
.fault = mmap_vmcore_fault,
462-
};
463-
464460
/**
465461
* vmcore_alloc_buf - allocate buffer in vmalloc memory
466462
* @size: size of buffer
@@ -488,6 +484,11 @@ static inline char *vmcore_alloc_buf(size_t size)
488484
* virtually contiguous user-space in ELF layout.
489485
*/
490486
#ifdef CONFIG_MMU
487+
488+
static const struct vm_operations_struct vmcore_mmap_ops = {
489+
.fault = mmap_vmcore_fault,
490+
};
491+
491492
/*
492493
* remap_oldmem_pfn_checked - do remap_oldmem_pfn_range replacing all pages
493494
* reported as not being ram with the zero page.

0 commit comments

Comments
 (0)