From f0b7bca64dbe8a15c1f4285c6061ce3c81a4a5c7 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Tue, 19 Jun 2018 15:41:41 +0200 Subject: pc-dimm: get_memory_region() will not fail after realize Let's try to reduce error handling a bit. In the plug/unplug case, the device was realized and therefore we can assume that getting access to the memory region will not fail. For get_vmstate_memory_region() this is already handled that way. Document both cases. Reviewed-by: Igor Mammedov Reviewed-by: David Gibson Signed-off-by: David Hildenbrand Message-Id: <20180619134141.29478-13-david@redhat.com> Signed-off-by: Paolo Bonzini --- hw/mem/pc-dimm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'hw/mem/pc-dimm.c') diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 4ff39b59ef..65843bc52a 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -37,15 +37,10 @@ void pc_dimm_plug(DeviceState *dev, MachineState *machine, uint64_t align, PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm, &error_abort); + MemoryRegion *mr = ddc->get_memory_region(dimm, &error_abort); Error *local_err = NULL; - MemoryRegion *mr; uint64_t addr; - mr = ddc->get_memory_region(dimm, &local_err); - if (local_err) { - goto out; - } - addr = object_property_get_uint(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { -- cgit v1.2.3