qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH v1 14/25] arm: digic: Update error API usages


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 14/25] arm: digic: Update error API usages
Date: Thu, 10 Sep 2015 22:33:24 -0700

Collect all errors and remove constant checking for realize failures.
Prefix errors and use error_report_err() as appropriate.

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

 hw/arm/digic.c        | 19 ++-----------------
 hw/arm/digic_boards.c |  4 ++--
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/hw/arm/digic.c b/hw/arm/digic.c
index ec8c330..2632517 100644
--- a/hw/arm/digic.c
+++ b/hw/arm/digic.c
@@ -60,36 +60,21 @@ static void digic_realize(DeviceState *dev, Error **errp)
     int i;
 
     object_property_set_bool(OBJECT(&s->cpu), true, "reset-hivecs", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
-
     object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     for (i = 0; i < DIGIC4_NB_TIMERS; i++) {
         object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
-        if (err != NULL) {
-            error_propagate(errp, err);
-            return;
-        }
 
         sbd = SYS_BUS_DEVICE(&s->timer[i]);
         sysbus_mmio_map(sbd, 0, DIGIC4_TIMER_BASE(i));
     }
 
     object_property_set_bool(OBJECT(&s->uart), true, "realized", &err);
-    if (err != NULL) {
-        error_propagate(errp, err);
-        return;
-    }
 
     sbd = SYS_BUS_DEVICE(&s->uart);
     sysbus_mmio_map(sbd, 0, DIGIC_UART_BASE);
+
+    error_propagate(errp, err);
 }
 
 static void digic_class_init(ObjectClass *oc, void *data)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index f8ba9e5..4256ece 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -64,8 +64,8 @@ static void digic4_board_init(DigicBoard *board)
     s->digic = DIGIC(object_new(TYPE_DIGIC));
     object_property_set_bool(OBJECT(s->digic), true, "realized", &err);
     if (err != NULL) {
-        error_report("Couldn't realize DIGIC SoC: %s",
-                     error_get_pretty(err));
+        error_prefix(err, "Couldn't realize DIGIC SoC: ");
+        error_report_err(err);
         exit(1);
     }
 
-- 
1.9.1




reply via email to

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