summary refs log tree commit diff stats
path: root/hw/pci-host
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-07-10 14:41:23 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-07-10 14:41:23 +0100
commitf2a1cf9180f63e88bb38ff21c169da97c3f2bad5 (patch)
treeb7582f17ac7fb572a23b02bfdac638d19d780d48 /hw/pci-host
parentb6d7e9b66f59ca6ebc6e9b830cd5e7bf849d31cf (diff)
parent1de7096d8378a57e2d75d9cacc9a119e7e41640d (diff)
downloadfocaccia-qemu-f2a1cf9180f63e88bb38ff21c169da97c3f2bad5.tar.gz
focaccia-qemu-f2a1cf9180f63e88bb38ff21c169da97c3f2bad5.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-07-07-v2' into staging
Error reporting patches patches for 2020-07-07

# gpg: Signature made Fri 10 Jul 2020 14:24:42 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2020-07-07-v2: (53 commits)
  xen: Use ERRP_GUARD()
  nbd: Use ERRP_GUARD()
  virtio-9p: Use ERRP_GUARD()
  fw_cfg: Use ERRP_GUARD()
  pflash: Use ERRP_GUARD()
  sd: Use ERRP_GUARD()
  scripts: Coccinelle script to use ERRP_GUARD()
  error: New macro ERRP_GUARD()
  hmp: Ignore Error objects where the return value suffices
  qdev: Ignore Error objects where the return value suffices
  qemu-img: Ignore Error objects where the return value suffices
  error: Avoid error_propagate() after migrate_add_blocker()
  qapi: Purge error_propagate() from QAPI core
  qapi: Smooth visitor error checking in generated code
  qapi: Smooth another visitor error checking pattern
  block/parallels: Simplify parallels_open() after previous commit
  error: Reduce unnecessary error propagation
  error: Eliminate error_propagate() manually
  error: Eliminate error_propagate() with Coccinelle, part 2
  error: Eliminate error_propagate() with Coccinelle, part 1
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/pci-host')
-rw-r--r--hw/pci-host/pnv_phb3.c33
-rw-r--r--hw/pci-host/pnv_phb4.c9
-rw-r--r--hw/pci-host/pnv_phb4_pec.c9
-rw-r--r--hw/pci-host/prep.c4
-rw-r--r--hw/pci-host/xen_igd_pt.c7
5 files changed, 24 insertions, 38 deletions
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 3ec904a55f..82132c12ca 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -990,7 +990,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
     PnvPHB3 *phb = PNV_PHB3(dev);
     PCIHostState *pci = PCI_HOST_BRIDGE(dev);
     PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
-    Error *local_err = NULL;
     int i;
 
     if (phb->phb_id >= PNV8_CHIP_PHB3_MAX) {
@@ -999,13 +998,11 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
     }
 
     /* LSI sources */
-    object_property_set_link(OBJECT(&phb->lsis), OBJECT(pnv), "xics",
-                                   &error_abort);
-    object_property_set_int(OBJECT(&phb->lsis), PNV_PHB3_NUM_LSI, "nr-irqs",
+    object_property_set_link(OBJECT(&phb->lsis), "xics", OBJECT(pnv),
+                             &error_abort);
+    object_property_set_int(OBJECT(&phb->lsis), "nr-irqs", PNV_PHB3_NUM_LSI,
                             &error_abort);
-    qdev_realize(DEVICE(&phb->lsis), NULL, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
+    if (!qdev_realize(DEVICE(&phb->lsis), NULL, errp)) {
         return;
     }
 
@@ -1016,24 +1013,20 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
     phb->qirqs = qemu_allocate_irqs(ics_set_irq, &phb->lsis, phb->lsis.nr_irqs);
 
     /* MSI sources */
-    object_property_set_link(OBJECT(&phb->msis), OBJECT(phb), "phb",
-                                   &error_abort);
-    object_property_set_link(OBJECT(&phb->msis), OBJECT(pnv), "xics",
-                                   &error_abort);
-    object_property_set_int(OBJECT(&phb->msis), PHB3_MAX_MSI, "nr-irqs",
+    object_property_set_link(OBJECT(&phb->msis), "phb", OBJECT(phb),
+                             &error_abort);
+    object_property_set_link(OBJECT(&phb->msis), "xics", OBJECT(pnv),
+                             &error_abort);
+    object_property_set_int(OBJECT(&phb->msis), "nr-irqs", PHB3_MAX_MSI,
                             &error_abort);
-    qdev_realize(DEVICE(&phb->msis), NULL, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
+    if (!qdev_realize(DEVICE(&phb->msis), NULL, errp)) {
         return;
     }
 
     /* Power Bus Common Queue */
-    object_property_set_link(OBJECT(&phb->pbcq), OBJECT(phb), "phb",
-                                   &error_abort);
-    qdev_realize(DEVICE(&phb->pbcq), NULL, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
+    object_property_set_link(OBJECT(&phb->pbcq), "phb", OBJECT(phb),
+                             &error_abort);
+    if (!qdev_realize(DEVICE(&phb->pbcq), NULL, errp)) {
         return;
     }
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 10716d759d..75ad766fe0 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1169,7 +1169,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
     PnvPHB4 *phb = PNV_PHB4(dev);
     PCIHostState *pci = PCI_HOST_BRIDGE(dev);
     XiveSource *xsrc = &phb->xsrc;
-    Error *local_err = NULL;
     int nr_irqs;
     char name[32];
 
@@ -1216,11 +1215,9 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
     } else {
         nr_irqs = PNV_PHB4_MAX_INTs >> 1;
     }
-    object_property_set_int(OBJECT(xsrc), nr_irqs, "nr-irqs", &error_fatal);
-    object_property_set_link(OBJECT(xsrc), OBJECT(phb), "xive", &error_fatal);
-    qdev_realize(DEVICE(xsrc), NULL, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
+    object_property_set_int(OBJECT(xsrc), "nr-irqs", nr_irqs, &error_fatal);
+    object_property_set_link(OBJECT(xsrc), "xive", OBJECT(phb), &error_fatal);
+    if (!qdev_realize(DEVICE(xsrc), NULL, errp)) {
         return;
     }
 
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 2d634c838e..741ddc90ed 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -377,7 +377,6 @@ static void pnv_pec_instance_init(Object *obj)
 static void pnv_pec_realize(DeviceState *dev, Error **errp)
 {
     PnvPhb4PecState *pec = PNV_PHB4_PEC(dev);
-    Error *local_err = NULL;
     char name[64];
     int i;
 
@@ -388,11 +387,9 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp)
         PnvPhb4PecStack *stack = &pec->stacks[i];
         Object *stk_obj = OBJECT(stack);
 
-        object_property_set_int(stk_obj, i, "stack-no", &error_abort);
-        object_property_set_link(stk_obj, OBJECT(pec), "pec", &error_abort);
-        qdev_realize(DEVICE(stk_obj), NULL, &local_err);
-        if (local_err) {
-            error_propagate(errp, local_err);
+        object_property_set_int(stk_obj, "stack-no", i, &error_abort);
+        object_property_set_link(stk_obj, "pec", OBJECT(pec), &error_abort);
+        if (!qdev_realize(DEVICE(stk_obj), NULL, errp)) {
             return;
         }
     }
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 367e408b91..4b93fd2b01 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -236,7 +236,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
         /* According to PReP specification section 6.1.6 "System Interrupt
          * Assignments", all PCI interrupts are routed via IRQ 15 */
         s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));
-        object_property_set_int(OBJECT(s->or_irq), PCI_NUM_PINS, "num-lines",
+        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,
                                 &error_fatal);
         qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);
         sysbus_init_irq(dev, &s->or_irq->out_irq);
@@ -307,7 +307,7 @@ static void raven_pcihost_initfn(Object *obj)
 
     object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE);
     pci_dev = DEVICE(&s->pci_dev);
-    object_property_set_int(OBJECT(&s->pci_dev), PCI_DEVFN(0, 0), "addr",
+    object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0),
                             NULL);
     qdev_prop_set_bit(pci_dev, "multifunction", false);
 }
diff --git a/hw/pci-host/xen_igd_pt.c b/hw/pci-host/xen_igd_pt.c
index efcc9347ff..d094b675d6 100644
--- a/hw/pci-host/xen_igd_pt.c
+++ b/hw/pci-host/xen_igd_pt.c
@@ -79,17 +79,16 @@ static void host_pci_config_read(int pos, int len, uint32_t *val, Error **errp)
 
 static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp)
 {
+    ERRP_GUARD();
     uint32_t val = 0;
     size_t i;
     int pos, len;
-    Error *local_err = NULL;
 
     for (i = 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) {
         pos = igd_host_bridge_infos[i].offset;
         len = igd_host_bridge_infos[i].len;
-        host_pci_config_read(pos, len, &val, &local_err);
-        if (local_err) {
-            error_propagate(errp, local_err);
+        host_pci_config_read(pos, len, &val, errp);
+        if (*errp) {
             return;
         }
         pci_default_write_config(pci_dev, pos, val, len);