From: Arnd Bergmann <arnd@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
Yu Zhang <yu.c.zhang@linux.intel.com>,
Isaku Yamahata <isaku.yamahata@intel.com>,
Chao Peng <chao.p.peng@linux.intel.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Sean Christopherson <seanjc@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] KVM: guest-memfd: fix unused-function warning
Date: Wed, 29 Nov 2023 16:32:40 +0100 [thread overview]
Message-ID: <20231129153250.3105359-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
With migration disabled, one function becomes unused:
virt/kvm/guest_memfd.c:262:12: error: 'kvm_gmem_migrate_folio' defined but not used [-Werror=unused-function]
262 | static int kvm_gmem_migrate_folio(struct address_space *mapping,
| ^~~~~~~~~~~~~~~~~~~~~~
Replace the #ifdef around the reference with a corresponding PTR_IF() check
that lets the compiler know how it is otherwise used.
Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
virt/kvm/guest_memfd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
index 16d58806e913..1a0355b95379 100644
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@ -301,9 +301,8 @@ static int kvm_gmem_error_folio(struct address_space *mapping,
static const struct address_space_operations kvm_gmem_aops = {
.dirty_folio = noop_dirty_folio,
-#ifdef CONFIG_MIGRATION
- .migrate_folio = kvm_gmem_migrate_folio,
-#endif
+ .migrate_folio = PTR_IF(IS_ENABLED(CONFIG_MIGRATION),
+ kvm_gmem_migrate_folio),
.error_remove_folio = kvm_gmem_error_folio,
};
--
2.39.2
next reply other threads:[~2023-11-29 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 15:32 Arnd Bergmann [this message]
2023-12-01 22:24 ` [PATCH] KVM: guest-memfd: fix unused-function warning Sean Christopherson
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=20231129153250.3105359-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=chao.p.peng@linux.intel.com \
--cc=isaku.yamahata@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=yu.c.zhang@linux.intel.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