diff mbox

[2/8] spapr: do proper error propagation in spapr_cpu_core_realize_child()

Message ID 146723343291.9665.15927503734917936760.stgit@bahia.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Greg Kurz June 29, 2016, 8:50 p.m. UTC
This patch changes spapr_cpu_core_realize_child() to have a local error
pointer and use error_propagate() as it is supposed to be done.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/ppc/spapr_cpu_core.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Bharata B Rao June 30, 2016, 4:28 a.m. UTC | #1
On Wed, Jun 29, 2016 at 10:50:32PM +0200, Greg Kurz wrote:
> This patch changes spapr_cpu_core_realize_child() to have a local error
> pointer and use error_propagate() as it is supposed to be done.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Reviewed-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
diff mbox

Patch

diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 789eb2e6f206..2615058da745 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -261,20 +261,22 @@  out:
 }
 
 static int spapr_cpu_core_realize_child(Object *child, void *opaque)
 {
-    Error **errp = opaque;
+    Error **errp = opaque, *local_err = NULL;
     sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
     CPUState *cs = CPU(child);
     PowerPCCPU *cpu = POWERPC_CPU(cs);
 
-    object_property_set_bool(child, true, "realized", errp);
-    if (*errp) {
+    object_property_set_bool(child, true, "realized", &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
         return 1;
     }
 
-    spapr_cpu_init(spapr, cpu, errp);
-    if (*errp) {
+    spapr_cpu_init(spapr, cpu, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
         return 1;
     }
     return 0;
 }