summaryrefslogtreecommitdiffstats
path: root/hw/ppc/spapr_nvdimm.c
diff options
context:
space:
mode:
authorGreg Kurz2020-10-19 10:49:01 +0200
committerDavid Gibson2020-10-27 15:08:53 +0100
commit6e837f98ba03bab8008b7c1a6c125298ce41de7a (patch)
tree5f9ca0f20e5c00fb8140e807c5193512bdb7c3fd /hw/ppc/spapr_nvdimm.c
parentspapr: Pass &error_abort when getting some PC DIMM properties (diff)
downloadqemu-6e837f98ba03bab8008b7c1a6c125298ce41de7a.tar.gz
qemu-6e837f98ba03bab8008b7c1a6c125298ce41de7a.tar.xz
qemu-6e837f98ba03bab8008b7c1a6c125298ce41de7a.zip
spapr: Simplify error handling in spapr_memory_plug()
As recommended in "qapi/error.h", add a bool return value to spapr_add_lmbs() and spapr_add_nvdimm(), and use them instead of local_err in spapr_memory_plug(). This allows to get rid of the error propagation overhead. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <160309734178.2739814.3488437759887793902.stgit@bahia.lan> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_nvdimm.c')
-rw-r--r--hw/ppc/spapr_nvdimm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c
index 9e3d94071f..a833a63b5e 100644
--- a/hw/ppc/spapr_nvdimm.c
+++ b/hw/ppc/spapr_nvdimm.c
@@ -89,7 +89,7 @@ bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm,
}
-void spapr_add_nvdimm(DeviceState *dev, uint64_t slot, Error **errp)
+bool spapr_add_nvdimm(DeviceState *dev, uint64_t slot, Error **errp)
{
SpaprDrc *drc;
bool hotplugged = spapr_drc_hotplugged(dev);
@@ -98,12 +98,13 @@ void spapr_add_nvdimm(DeviceState *dev, uint64_t slot, Error **errp)
g_assert(drc);
if (!spapr_drc_attach(drc, dev, errp)) {
- return;
+ return false;
}
if (hotplugged) {
spapr_hotplug_req_add_by_index(drc);
}
+ return true;
}
static int spapr_dt_nvdimm(SpaprMachineState *spapr, void *fdt,