qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 15/25] cpu: arm: Remove un-needed error check


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 15/25] cpu: arm: Remove un-needed error checking
Date: Thu, 10 Sep 2015 22:33:25 -0700

Collect all errors and remove constant checking for realize failures.

Cc: Peter Maydell <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---

 hw/cpu/a15mpcore.c       |  6 ++----
 hw/cpu/a9mpcore.c        | 22 ++--------------------
 hw/cpu/arm11mpcore.c     | 18 ++----------------
 hw/cpu/realview_mpcore.c |  9 +--------
 4 files changed, 7 insertions(+), 48 deletions(-)

diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
index 58ac02e..b7da299 100644
--- a/hw/cpu/a15mpcore.c
+++ b/hw/cpu/a15mpcore.c
@@ -57,10 +57,6 @@ static void a15mp_priv_realize(DeviceState *dev, Error 
**errp)
     qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
     qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
     object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     busdev = SYS_BUS_DEVICE(&s->gic);
 
     /* Pass through outbound IRQ lines from the GIC */
@@ -104,6 +100,8 @@ static void a15mp_priv_realize(DeviceState *dev, Error 
**errp)
                                 sysbus_mmio_get_region(busdev, 0));
     memory_region_add_subregion(&s->container, 0x2000,
                                 sysbus_mmio_get_region(busdev, 1));
+
+    error_propagate(errp, err);
 }
 
 static Property a15mp_priv_properties[] = {
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
index c09358c..41f5a96 100644
--- a/hw/cpu/a9mpcore.c
+++ b/hw/cpu/a9mpcore.c
@@ -53,20 +53,12 @@ static void a9mp_priv_realize(DeviceState *dev, Error 
**errp)
     scudev = DEVICE(&s->scu);
     qdev_prop_set_uint32(scudev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->scu), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     scubusdev = SYS_BUS_DEVICE(&s->scu);
 
     gicdev = DEVICE(&s->gic);
     qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
     qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
     object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     gicbusdev = SYS_BUS_DEVICE(&s->gic);
 
     /* Pass through outbound IRQ lines from the GIC */
@@ -78,28 +70,16 @@ static void a9mp_priv_realize(DeviceState *dev, Error 
**errp)
     gtimerdev = DEVICE(&s->gtimer);
     qdev_prop_set_uint32(gtimerdev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->gtimer), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     gtimerbusdev = SYS_BUS_DEVICE(&s->gtimer);
 
     mptimerdev = DEVICE(&s->mptimer);
     qdev_prop_set_uint32(mptimerdev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->mptimer), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     mptimerbusdev = SYS_BUS_DEVICE(&s->mptimer);
 
     wdtdev = DEVICE(&s->wdt);
     qdev_prop_set_uint32(wdtdev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->wdt), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     wdtbusdev = SYS_BUS_DEVICE(&s->wdt);
 
     /* Memory map (addresses are offsets from PERIPHBASE):
@@ -141,6 +121,8 @@ static void a9mp_priv_realize(DeviceState *dev, Error 
**errp)
         sysbus_connect_irq(wdtbusdev, i,
                            qdev_get_gpio_in(gicdev, ppibase + 30));
     }
+
+    error_propagate(errp, err);
 }
 
 static Property a9mp_priv_properties[] = {
diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c
index 717d3e4..5ba8977 100644
--- a/hw/cpu/arm11mpcore.c
+++ b/hw/cpu/arm11mpcore.c
@@ -74,18 +74,10 @@ static void mpcore_priv_realize(DeviceState *dev, Error 
**errp)
 
     qdev_prop_set_uint32(scudev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->scu), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
     qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
     object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     /* Pass through outbound IRQ lines from the GIC */
     sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->gic));
@@ -95,19 +87,13 @@ static void mpcore_priv_realize(DeviceState *dev, Error 
**errp)
 
     qdev_prop_set_uint32(mptimerdev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->mptimer), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     qdev_prop_set_uint32(wdtimerdev, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->wdtimer), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     mpcore_priv_map_setup(s);
+
+    error_propagate(errp, err);
 }
 
 static void mpcore_priv_initfn(Object *obj)
diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c
index c39a2da..f6c3b89 100644
--- a/hw/cpu/realview_mpcore.c
+++ b/hw/cpu/realview_mpcore.c
@@ -66,10 +66,6 @@ static void realview_mpcore_realize(DeviceState *dev, Error 
**errp)
 
     qdev_prop_set_uint32(priv, "num-cpu", s->num_cpu);
     object_property_set_bool(OBJECT(&s->priv), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
     sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->priv));
     for (i = 0; i < 32; i++) {
         s->cpuic[i] = qdev_get_gpio_in(priv, i);
@@ -77,10 +73,6 @@ static void realview_mpcore_realize(DeviceState *dev, Error 
**errp)
     /* ??? IRQ routing is hardcoded to "normal" mode.  */
     for (n = 0; n < 4; n++) {
         object_property_set_bool(OBJECT(&s->gic[n]), true, "realized", &err);
-        if (err != NULL) {
-            error_propagate(errp, err);
-            return;
-        }
         gic = DEVICE(&s->gic[n]);
         gicbusdev = SYS_BUS_DEVICE(&s->gic[n]);
         sysbus_mmio_map(gicbusdev, 0, 0x10040000 + n * 0x10000);
@@ -90,6 +82,7 @@ static void realview_mpcore_realize(DeviceState *dev, Error 
**errp)
         }
     }
     qdev_init_gpio_in(dev, mpcore_rirq_set_irq, 64);
+    error_propagate(errp, err);
 }
 
 static void mpcore_rirq_init(Object *obj)
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]