From: Nick Desaulniers <nick.desaulniers@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: josh@joshtriplett.org, kay@vrfy.org, avi@redhat.com,
"Nick Desaulniers" <nick.desaulniers@gmail.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: [PATCH] KVM: VMX: check match table
Date: Mon, 25 Sep 2017 21:25:38 -0700 [thread overview]
Message-ID: <20170926042540.10100-1-nick.desaulniers@gmail.com> (raw)
In-Reply-To: <CAH7mPvgYREBRHY=2=HXOAg=v2SfLMCdO8gDkYTPsY+oRMCKMBA@mail.gmail.com>
Fixes the warning:
arch/x86/kvm/vmx.c:64:32: warning: variable 'vmx_cpu_id' is not needed
and will not be emitted [-Wunneeded-internal-declaration]``
Other callers of MODULE_DEVICE_TABLE() seem to check their second
argument during driver init with the x86_match_cpu() function, if their
first argument to MODULE_DEVICE_TABLE() is x86cpu. The documentation
for x86_match_cpu() seems to agree.
Suggested-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
arch/x86/kernel/cpu/match.c | 2 +-
arch/x86/kvm/vmx.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
index e42117d5f4d7..fb1aeafa5cc7 100644
--- a/arch/x86/kernel/cpu/match.c
+++ b/arch/x86/kernel/cpu/match.c
@@ -5,7 +5,7 @@
#include <linux/slab.h>
/**
- * x86_match_cpu - match current CPU again an array of x86_cpu_ids
+ * x86_match_cpu - match current CPU against an array of x86_cpu_ids
* @match: Pointer to array of x86_cpu_ids. Last entry terminated with
* {}.
*
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6970249c09fc..e1a00b130935 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -12074,7 +12074,12 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
static int __init vmx_init(void)
{
- int r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
+ int r;
+
+ if (!x86_match_cpu(vmx_cpu_id))
+ return -ENODEV;
+
+ r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
__alignof__(struct vcpu_vmx), THIS_MODULE);
if (r)
return r;
--
2.11.0
next prev parent reply other threads:[~2017-09-26 4:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 3:07 unneeded internal declaration Nick Desaulniers
2017-09-26 3:35 ` Josh Triplett
2017-09-26 4:15 ` Nick Desaulniers
2017-09-26 4:25 ` Nick Desaulniers [this message]
2017-09-26 17:12 ` [PATCH] KVM: VMX: check match table Josh Triplett
2017-09-27 12:36 ` Paolo Bonzini
2017-09-30 23:22 ` Nick Desaulniers
2017-10-03 9:42 ` Paolo Bonzini
2017-10-04 2:54 ` Nick Desaulniers
2017-10-04 2:58 ` Nick Desaulniers
2017-09-27 14:14 ` kbuild test robot
2017-09-27 12:38 ` unneeded internal declaration Paolo Bonzini
[not found] ` <CAK5g=XOWn=nUpa1Q0Oc4CntRX0LbJjbatJKLUgQOCsaba_3hNw@mail.gmail.com>
2017-09-27 12:50 ` Paolo Bonzini
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=20170926042540.10100-1-nick.desaulniers@gmail.com \
--to=nick.desaulniers@gmail.com \
--cc=avi@redhat.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=kay@vrfy.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).