diff mbox series

[15/15] spapr: Simplify error handling in spapr_memory_unplug_request()

Message ID 20200914123505.612812-16-groug@kaod.org
State New
Headers show
Series spapr: Error handling fixes and cleanups (round 2) | expand

Commit Message

Greg Kurz Sept. 14, 2020, 12:35 p.m. UTC
Since object_property_get_uint() only returns 0 on failure, use
that instead of local_err, and get rid of the error propagation
overhead.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/ppc/spapr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d6b4de6a1c53..2eca9dc26668 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3609,7 +3609,6 @@  static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
                                         DeviceState *dev, Error **errp)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(hotplug_dev);
-    Error *local_err = NULL;
     PCDIMMDevice *dimm = PC_DIMM(dev);
     uint32_t nr_lmbs;
     uint64_t size, addr_start, addr;
@@ -3625,9 +3624,8 @@  static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
     nr_lmbs = size / SPAPR_MEMORY_BLOCK_SIZE;
 
     addr_start = object_property_get_uint(OBJECT(dimm), PC_DIMM_ADDR_PROP,
-                                         &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
+                                          errp);
+    if (!addr_start) {
         return;
     }