linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm/emulate: fix a -Werror=cast-function-type
@ 2020-02-14 15:56 Qian Cai
  2020-02-14 16:59 ` Sean Christopherson
  0 siblings, 1 reply; 9+ messages in thread
From: Qian Cai @ 2020-02-14 15:56 UTC (permalink / raw)
  To: pbonzini
  Cc: sean.j.christopherson, vkuznets, wanpengli, jmattson, joro, kvm,
	linux-kernel, Qian Cai

arch/x86/kvm/emulate.c: In function 'x86_emulate_insn':
arch/x86/kvm/emulate.c:5686:22: error: cast between incompatible
function types from 'int (*)(struct x86_emulate_ctxt *)' to 'void
(*)(struct fastop *)' [-Werror=cast-function-type]
    rc = fastop(ctxt, (fastop_t)ctxt->execute);

Fixes: 3009afc6e39e ("KVM: x86: Use a typedef for fastop functions")
Signed-off-by: Qian Cai <cai@lca.pw>
---
 arch/x86/kvm/emulate.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index ddbc61984227..17ae820cf59d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -5682,10 +5682,12 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 		ctxt->eflags &= ~X86_EFLAGS_RF;
 
 	if (ctxt->execute) {
-		if (ctxt->d & Fastop)
-			rc = fastop(ctxt, (fastop_t)ctxt->execute);
-		else
+		if (ctxt->d & Fastop) {
+			fastop_t fop = (void *)ctxt->execute;
+			rc = fastop(ctxt, fop);
+		} else {
 			rc = ctxt->execute(ctxt);
+		}
 		if (rc != X86EMUL_CONTINUE)
 			goto done;
 		goto writeback;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-17 16:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 15:56 [PATCH] kvm/emulate: fix a -Werror=cast-function-type Qian Cai
2020-02-14 16:59 ` Sean Christopherson
2020-02-14 17:08   ` Qian Cai
2020-02-14 17:40     ` Jim Mattson
2020-02-14 19:14       ` Qian Cai
2020-02-14 19:33         ` Paolo Bonzini
2020-02-14 19:54           ` Sean Christopherson
2020-02-17 14:47           ` Qian Cai
2020-02-17 16:32             ` Paolo Bonzini

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).