586cba
From 9ddefaedf423ec03eadaf17496c14e0d7b2381c8 Mon Sep 17 00:00:00 2001
586cba
From: Cornelia Huck <cohuck@redhat.com>
586cba
Date: Thu, 28 Jul 2022 16:24:46 +0200
586cba
Subject: [PATCH 30/32] kvm: don't use perror() without useful errno
586cba
586cba
RH-Author: Cornelia Huck <cohuck@redhat.com>
586cba
RH-MergeRequest: 110: kvm: don't use perror() without useful errno
586cba
RH-Commit: [1/1] 20e51aac6767c1f89f74c7d692d1fb7689eff5f0 (cohuck/qemu-kvm-c9s)
586cba
RH-Bugzilla: 2095608
586cba
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
586cba
RH-Acked-by: Thomas Huth <thuth@redhat.com>
586cba
RH-Acked-by: Gavin Shan <gshan@redhat.com>
586cba
586cba
perror() is designed to append the decoded errno value to a
586cba
string. This, however, only makes sense if we called something that
586cba
actually sets errno prior to that.
586cba
586cba
For the callers that check for split irqchip support that is not the
586cba
case, and we end up with confusing error messages that end in
586cba
"success". Use error_report() instead.
586cba
586cba
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
586cba
Message-Id: <20220728142446.438177-1-cohuck@redhat.com>
586cba
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
586cba
586cba
https://bugzilla.redhat.com/show_bug.cgi?id=2095608
586cba
(cherry picked from commit 47c182fe8b03c0c40059fb95840923e65c9bdb4f)
586cba
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
586cba
---
586cba
 accel/kvm/kvm-all.c | 2 +-
586cba
 target/arm/kvm.c    | 2 +-
586cba
 2 files changed, 2 insertions(+), 2 deletions(-)
586cba
586cba
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
586cba
index 5f1377ca04..e9c7947640 100644
586cba
--- a/accel/kvm/kvm-all.c
586cba
+++ b/accel/kvm/kvm-all.c
586cba
@@ -2254,7 +2254,7 @@ static void kvm_irqchip_create(KVMState *s)
586cba
     ret = kvm_arch_irqchip_create(s);
586cba
     if (ret == 0) {
586cba
         if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
586cba
-            perror("Split IRQ chip mode not supported.");
586cba
+            error_report("Split IRQ chip mode not supported.");
586cba
             exit(1);
586cba
         } else {
586cba
             ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
586cba
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
586cba
index bbf1ce7ba3..0a2ba1f8e3 100644
586cba
--- a/target/arm/kvm.c
586cba
+++ b/target/arm/kvm.c
586cba
@@ -960,7 +960,7 @@ void kvm_arch_init_irq_routing(KVMState *s)
586cba
 int kvm_arch_irqchip_create(KVMState *s)
586cba
 {
586cba
     if (kvm_kernel_irqchip_split()) {
586cba
-        perror("-machine kernel_irqchip=split is not supported on ARM.");
586cba
+        error_report("-machine kernel_irqchip=split is not supported on ARM.");
586cba
         exit(1);
586cba
     }
586cba
 
586cba
-- 
586cba
2.31.1
586cba