static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

                              uint32_t node, Error **errp)

{

    Error *local_err = NULL;

    sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev);

    PCDIMMDevice *dimm = PC_DIMM(dev);

    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);

    MemoryRegion *mr = ddc->get_memory_region(dimm);

    uint64_t align = memory_region_get_alignment(mr);

    uint64_t size = memory_region_size(mr);

    uint64_t addr;



    if (size % SPAPR_MEMORY_BLOCK_SIZE) {

        error_setg(&local_err, "Hotplugged memory size must be a multiple of "

                      "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);

        goto out;

    }



    pc_dimm_memory_plug(dev, &ms->hotplug_memory, mr, align, &local_err);

    if (local_err) {

        goto out;

    }



    addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err);

    if (local_err) {

        pc_dimm_memory_unplug(dev, &ms->hotplug_memory, mr);

        goto out;

    }



    spapr_add_lmbs(dev, addr, size, node, &error_abort);



out:

    error_propagate(errp, local_err);

}

static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

                              uint32_t node, Error **errp)

{

    Error *local_err = NULL;

    sPAPRMachineState *ms = SPAPR_MACHINE(hotplug_dev);

    PCDIMMDevice *dimm = PC_DIMM(dev);

    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);

    MemoryRegion *mr = ddc->get_memory_region(dimm);

    uint64_t align = memory_region_get_alignment(mr);

    uint64_t size = memory_region_size(mr);

    uint64_t addr;



    if (size % SPAPR_MEMORY_BLOCK_SIZE) {

        error_setg(&local_err, "Hotplugged memory size must be a multiple of "

                      "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);

        goto out;

    }



    pc_dimm_memory_plug(dev, &ms->hotplug_memory, mr, align, &local_err);

    if (local_err) {

        goto out;

    }



    addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err);

    if (local_err) {

        pc_dimm_memory_unplug(dev, &ms->hotplug_memory, mr);

        goto out;

    }



    spapr_add_lmbs(dev, addr, size, node, &error_abort);



out:

    error_propagate(errp, local_err);

}

    spapr_add_lmbs(dev, addr, size, node, &error_abort);
static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,

                              uint32_t VAR_2, Error **VAR_3)

{

    Error *local_err = NULL;

    sPAPRMachineState *ms = SPAPR_MACHINE(VAR_0);

    PCDIMMDevice *dimm = PC_DIMM(VAR_1);

    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);

    MemoryRegion *mr = ddc->get_memory_region(dimm);

    uint64_t align = memory_region_get_alignment(mr);

    uint64_t size = memory_region_size(mr);

    uint64_t addr;



    if (size % SPAPR_MEMORY_BLOCK_SIZE) {

        error_setg(&local_err, "Hotplugged memory size must be a multiple of "

                      "%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE);

        goto out;

    }



    pc_dimm_memory_plug(VAR_1, &ms->hotplug_memory, mr, align, &local_err);

    if (local_err) {

        goto out;

    }



    addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err);

    if (local_err) {

        pc_dimm_memory_unplug(VAR_1, &ms->hotplug_memory, mr);

        goto out;

    }



    spapr_add_lmbs(VAR_1, addr, size, VAR_2, &error_abort);



out:

    error_propagate(VAR_3, local_err);

}

static void FUNC_0(HotplugHandler *VAR_0, DeviceState *VAR_1,
uint32_t VAR_2, Error **VAR_3)
{ Error *local_err = NULL; sPAPRMachineState *ms = SPAPR_MACHINE(VAR_0); PCDIMMDevice *dimm = PC_DIMM(VAR_1); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t align = memory_region_get_alignment(mr); uint64_t size = memory_region_size(mr); uint64_t addr; if (size % SPAPR_MEMORY_BLOCK_SIZE) { error_setg(&local_err, "Hotplugged memory size must be a multiple of "
"%lld MB", SPAPR_MEMORY_BLOCK_SIZE/M_BYTE); goto out; } pc_dimm_memory_plug(VAR_1, &ms->hotplug_memory, mr, align, &local_err); if (local_err) { goto out; } addr = object_property_get_int(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { pc_dimm_memory_unplug(VAR_1, &ms->hotplug_memory, mr); goto out; } spapr_add_lmbs(VAR_1, addr, size, VAR_2, &error_abort); out:
error_propagate(VAR_3, local_err); }