mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Qi Xi <xiqi2@huawei.com>
Cc: <bobo.shaobowang@huawei.com>, <bhe@redhat.com>,
	<vgoyal@redhat.com>, <dyoung@redhat.com>,
	<holzheu@linux.vnet.ibm.com>, <kexec@lists.infradead.org>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs/proc: Fix compile warning about variable 'vmcore_mmap_ops'
Date: Thu, 31 Oct 2024 18:52:35 -0700	[thread overview]
Message-ID: <20241031185235.8bb482766ab10d2ab19fd3f6@linux-foundation.org> (raw)
In-Reply-To: <20241031072746.12897-1-xiqi2@huawei.com>

On Thu, 31 Oct 2024 15:27:46 +0800 Qi Xi <xiqi2@huawei.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?

  reply	other threads:[~2024-11-01  1:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  7:27 Qi Xi
2024-11-01  1:52 ` Andrew Morton [this message]
2024-11-01  3:23   ` [PATCH v2] " Qi Xi
2024-11-01  3:38     ` Jinjie Ruan
2024-11-01  3:43       ` [PATCH v3] " Qi Xi
2024-11-01  3:48       ` Qi Xi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241031185235.8bb482766ab10d2ab19fd3f6@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=dyoung@redhat.com \
    --cc=holzheu@linux.vnet.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    --cc=xiqi2@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®