qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Huacai Chen" <chenhuacai@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aleksandar Markovic" <aleksandar.qemu.devel@gmail.com>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH 2/2] target/mips/kvm: Assert unreachable code is not used
Date: Wed, 29 Apr 2020 10:29:16 +0200	[thread overview]
Message-ID: <20200429082916.10669-3-f4bug@amsat.org> (raw)
In-Reply-To: <20200429082916.10669-1-f4bug@amsat.org>

This code must not be used outside of KVM. Abort if it is.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/kvm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index de3e26ef1f..050bfbd7fa 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -196,9 +196,7 @@ int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level)
     CPUState *cs = CPU(cpu);
     struct kvm_mips_interrupt intr;
 
-    if (!kvm_enabled()) {
-        return 0;
-    }
+    assert(kvm_enabled());
 
     intr.cpu = -1;
 
@@ -219,9 +217,7 @@ int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level)
     CPUState *dest_cs = CPU(cpu);
     struct kvm_mips_interrupt intr;
 
-    if (!kvm_enabled()) {
-        return 0;
-    }
+    assert(kvm_enabled());
 
     intr.cpu = dest_cs->cpu_index;
 
-- 
2.21.1



  parent reply	other threads:[~2020-04-29  8:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  8:29 [PATCH 0/2] mips: Minor simplifications for KVM use Philippe Mathieu-Daudé
2020-04-29  8:29 ` [PATCH 1/2] hw/mips/mips_int: De-duplicate KVM interrupt delivery Philippe Mathieu-Daudé
2020-04-29  8:48   ` chen huacai
2020-05-12  7:08     ` Philippe Mathieu-Daudé
2020-05-26  7:57       ` Thomas Huth
2020-05-26  8:17         ` Philippe Mathieu-Daudé
2020-04-29  8:29 ` Philippe Mathieu-Daudé [this message]
2020-05-12  7:09   ` [PATCH 2/2] target/mips/kvm: Assert unreachable code is not used Philippe Mathieu-Daudé
2020-11-24 10:41     ` Philippe Mathieu-Daudé
2020-11-24 11:02       ` Paolo Bonzini
2020-12-07 22:23         ` Philippe Mathieu-Daudé
2020-11-25  1:16       ` Huacai Chen
2020-05-26  7:52 ` [PATCH 0/2] mips: Minor simplifications for KVM use Philippe Mathieu-Daudé

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=20200429082916.10669-3-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=chenhuacai@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=qemu-devel@nongnu.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).