[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241031185235.8bb482766ab10d2ab19fd3f6@linux-foundation.org>
Date: Thu, 31 Oct 2024 18:52:35 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Qi Xi <xiqi2@...wei.com>
Cc: <bobo.shaobowang@...wei.com>, <bhe@...hat.com>, <vgoyal@...hat.com>,
<dyoung@...hat.com>, <holzheu@...ux.vnet.ibm.com>,
<kexec@...ts.infradead.org>, <linux-fsdevel@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fs/proc: Fix compile warning about variable
'vmcore_mmap_ops'
On Thu, 31 Oct 2024 15:27:46 +0800 Qi Xi <xiqi2@...wei.com> wrote:
> 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.
>
It's better to move the definition inside #ifdef CONFIG_MMU, perhaps this:
--- a/fs/proc/vmcore.c~a
+++ a/fs/proc/vmcore.c
@@ -457,10 +457,6 @@ static vm_fault_t mmap_vmcore_fault(stru
#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
@@ -488,6 +484,11 @@ static inline char *vmcore_alloc_buf(siz
* 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.
_
Please check and test that and send it back at us a a v2 patch?
Powered by blists - more mailing lists