[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/15] spapr: Simplify error handling in spapr_vio_busdev_realize
From: |
Greg Kurz |
Subject: |
[PATCH 07/15] spapr: Simplify error handling in spapr_vio_busdev_realize() |
Date: |
Mon, 14 Sep 2020 14:34:57 +0200 |
Use the return value of spapr_irq_findone() and spapr_irq_claim()
to detect failures. This allows to reduce the error propagation
overhead.
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/ppc/spapr_vio.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 731080d989f1..44fdd64b88af 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -474,7 +474,6 @@ static void spapr_vio_busdev_realize(DeviceState *qdev,
Error **errp)
SpaprVioDevice *dev = (SpaprVioDevice *)qdev;
SpaprVioDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);
char *id;
- Error *local_err = NULL;
if (dev->reg != -1) {
/*
@@ -510,16 +509,15 @@ static void spapr_vio_busdev_realize(DeviceState *qdev,
Error **errp)
dev->irq = spapr_vio_reg_to_irq(dev->reg);
if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
- dev->irq = spapr_irq_findone(spapr, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
+ int irq = spapr_irq_findone(spapr, errp);
+
+ if (irq < 0) {
return;
}
+ dev->irq = irq;
}
- spapr_irq_claim(spapr, dev->irq, false, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
+ if (spapr_irq_claim(spapr, dev->irq, false, errp) < 0) {
return;
}
--
2.26.2
- Re: [PATCH 02/15] ppc: Add a return value to ppc_set_compat() and ppc_set_compat_all(), (continued)
- [PATCH 04/15] spapr: Simplify error handling in callers of ppc_set_compat(), Greg Kurz, 2020/09/14
- [PATCH 03/15] ppc: Fix return value in cpu_post_load() error path, Greg Kurz, 2020/09/14
- [PATCH 05/15] spapr: Get rid of cas_check_pvr() error reporting, Greg Kurz, 2020/09/14
- [PATCH 07/15] spapr: Simplify error handling in spapr_vio_busdev_realize(),
Greg Kurz <=
- [PATCH 06/15] spapr: Simplify error handling in do_client_architecture_support(), Greg Kurz, 2020/09/14
- [PATCH 08/15] spapr: Add a return value to spapr_drc_attach(), Greg Kurz, 2020/09/14
- [PATCH 09/15] spapr: Simplify error handling in prop_get_fdt(), Greg Kurz, 2020/09/14
- [PATCH 10/15] spapr: Add a return value to spapr_set_vcpu_id(), Greg Kurz, 2020/09/14