summaryrefslogtreecommitdiffstats
path: root/hw/ppc/spapr_vio.c
diff options
context:
space:
mode:
authorGreg Kurz2020-09-14 14:34:57 +0200
committerDavid Gibson2020-10-09 01:15:06 +0200
commita9c2cdace0a9f42d4a2b1b230baab96819b79641 (patch)
treea4e629381de6724bffc054f79b3baea76bda60e7 /hw/ppc/spapr_vio.c
parentspapr: Simplify error handling in do_client_architecture_support() (diff)
downloadqemu-a9c2cdace0a9f42d4a2b1b230baab96819b79641.tar.gz
qemu-a9c2cdace0a9f42d4a2b1b230baab96819b79641.tar.xz
qemu-a9c2cdace0a9f42d4a2b1b230baab96819b79641.zip
spapr: Simplify error handling in spapr_vio_busdev_realize()
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> Message-Id: <20200914123505.612812-8-groug@kaod.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_vio.c')
-rw-r--r--hw/ppc/spapr_vio.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 731080d989..44fdd64b88 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;
}