qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-7.1?] kvm: don't use perror() without useful errno
@ 2022-07-28 14:24 Cornelia Huck
  2022-07-28 17:13 ` Richard Henderson
  2022-07-28 22:12 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Cornelia Huck @ 2022-07-28 14:24 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Maydell; +Cc: qemu-devel, qemu-arm, Cornelia Huck

perror() is designed to append the decoded errno value to a
string. This, however, only makes sense if we called something that
actually sets errno prior to that.

For the callers that check for split irqchip support that is not the
case, and we end up with confusing error messages that end in
"success". Use error_report() instead.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---

Not sure if that is still 7.1 material; on the one hand, it's a small
fix; on the other hand, it has been like that forever...

I've kept the Arm-specific message in place, although it might be redundant.

---
 accel/kvm/kvm-all.c | 2 +-
 target/arm/kvm.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 99aede73b7cb..6955c0b23a22 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2265,7 +2265,7 @@ static void kvm_irqchip_create(KVMState *s)
     ret = kvm_arch_irqchip_create(s);
     if (ret == 0) {
         if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
-            perror("Split IRQ chip mode not supported.");
+            error_report("Split IRQ chip mode not supported.");
             exit(1);
         } else {
             ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 4339e1cd6e08..e5c1bd50d29b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -959,7 +959,7 @@ void kvm_arch_init_irq_routing(KVMState *s)
 int kvm_arch_irqchip_create(KVMState *s)
 {
     if (kvm_kernel_irqchip_split()) {
-        perror("-machine kernel_irqchip=split is not supported on ARM.");
+        error_report("-machine kernel_irqchip=split is not supported on ARM.");
         exit(1);
     }
 
-- 
2.35.3



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

* Re: [PATCH for-7.1?] kvm: don't use perror() without useful errno
  2022-07-28 14:24 [PATCH for-7.1?] kvm: don't use perror() without useful errno Cornelia Huck
@ 2022-07-28 17:13 ` Richard Henderson
  2022-07-28 22:12 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-07-28 17:13 UTC (permalink / raw)
  To: Cornelia Huck, Paolo Bonzini, Peter Maydell; +Cc: qemu-devel, qemu-arm

On 7/28/22 07:24, Cornelia Huck wrote:
> perror() is designed to append the decoded errno value to a
> string. This, however, only makes sense if we called something that
> actually sets errno prior to that.
> 
> For the callers that check for split irqchip support that is not the
> case, and we end up with confusing error messages that end in
> "success". Use error_report() instead.
> 
> Signed-off-by: Cornelia Huck<cohuck@redhat.com>
> ---

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH for-7.1?] kvm: don't use perror() without useful errno
  2022-07-28 14:24 [PATCH for-7.1?] kvm: don't use perror() without useful errno Cornelia Huck
  2022-07-28 17:13 ` Richard Henderson
@ 2022-07-28 22:12 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-07-28 22:12 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: Peter Maydell, qemu-devel, qemu-arm

Queued, thanks.

Paolo




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

end of thread, other threads:[~2022-07-28 22:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 14:24 [PATCH for-7.1?] kvm: don't use perror() without useful errno Cornelia Huck
2022-07-28 17:13 ` Richard Henderson
2022-07-28 22:12 ` 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).