Skip to contentSkip to conversation

fs/proc/vmcore: hide mmap_vmcore_fault() and vmcore_mmap_ops for nommu

PATCH New Jisheng Zhang 1 participant 1 message Jun 12, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/proc/vmcore: hide mmap_vmcore_fault() and vmcore_mmap_ops for nommu

From: Jisheng Zhang <[email protected]>

Without CONFIG_MMU, we get a W=1 build warning:

fs/proc/vmcore.c:443:42: warning: unused variable 'vmcore_mmap_ops' [-Wunused-const-variable] static const struct vm_operations_struct vmcore_mmap_ops = {

The vmcore_mmap_ops is only referenced from an #ifdef'ed caller, so this uses the same #ifdef around vmcore_mmap_ops and mmap_vmcore_fault().

---
 fs/proc/vmcore.c | 2 ++
 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
index 9a15334da208..d902a67cc3ea 100644
@@ -401,6 +401,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
 	return __read_vmcore((__force char *) buffer, buflen, fpos, 1);
 }
 
+#ifdef CONFIG_MMU
 /*
  * The vmcore fault handler uses the page cache and fills data using the
  * standard __vmcore_read() function.
@@ -443,6 +444,7 @@ static vm_fault_t mmap_vmcore_fault(struct vm_fault *vmf)
 static const struct vm_operations_struct vmcore_mmap_ops = {
 	.fault = mmap_vmcore_fault,
 };
+#endif
 
 /**
  * vmcore_alloc_buf - allocate buffer in vmalloc memory
Signature · 1 line
2.32.0