static void spapr_phb_add_pci_device(sPAPRDRConnector *drc,

                                     sPAPRPHBState *phb,

                                     PCIDevice *pdev,

                                     Error **errp)

{

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    DeviceState *dev = DEVICE(pdev);

    int drc_index = drck->get_index(drc);

    void *fdt = NULL;

    int fdt_start_offset = 0, fdt_size;



    if (dev->hotplugged) {

        fdt = create_device_tree(&fdt_size);

        fdt_start_offset = spapr_create_pci_child_dt(phb, pdev,

                                                     drc_index, NULL,

                                                     fdt, 0);

        if (!fdt_start_offset) {

            error_setg(errp, "Failed to create pci child device tree node");

            goto out;

        }

    }



    drck->attach(drc, DEVICE(pdev),

                 fdt, fdt_start_offset, !dev->hotplugged, errp);

out:

    if (*errp) {

        g_free(fdt);

    }

}

static void spapr_phb_add_pci_device(sPAPRDRConnector *drc,

                                     sPAPRPHBState *phb,

                                     PCIDevice *pdev,

                                     Error **errp)

{

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    DeviceState *dev = DEVICE(pdev);

    int drc_index = drck->get_index(drc);

    void *fdt = NULL;

    int fdt_start_offset = 0, fdt_size;



    if (dev->hotplugged) {

        fdt = create_device_tree(&fdt_size);

        fdt_start_offset = spapr_create_pci_child_dt(phb, pdev,

                                                     drc_index, NULL,

                                                     fdt, 0);

        if (!fdt_start_offset) {

            error_setg(errp, "Failed to create pci child device tree node");

            goto out;

        }

    }



    drck->attach(drc, DEVICE(pdev),

                 fdt, fdt_start_offset, !dev->hotplugged, errp);

out:

    if (*errp) {

        g_free(fdt);

    }

}

static void FUNC_0(sPAPRDRConnector *VAR_0,

                                     sPAPRPHBState *VAR_1,

                                     PCIDevice *VAR_2,

                                     Error **VAR_3)

{

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(VAR_0);

    DeviceState *dev = DEVICE(VAR_2);

    int VAR_4 = drck->get_index(VAR_0);

    void *VAR_5 = NULL;

    int VAR_6 = 0, VAR_7;



    if (dev->hotplugged) {

        VAR_5 = create_device_tree(&VAR_7);

        VAR_6 = spapr_create_pci_child_dt(VAR_1, VAR_2,

                                                     VAR_4, NULL,

                                                     VAR_5, 0);

        if (!VAR_6) {

            error_setg(VAR_3, "Failed to create pci child device tree node");

            goto out;

        }

    }



    drck->attach(VAR_0, DEVICE(VAR_2),

                 VAR_5, VAR_6, !dev->hotplugged, VAR_3);

out:

    if (*VAR_3) {

        g_free(VAR_5);

    }

}

static void FUNC_0(sPAPRDRConnector *VAR_0,
sPAPRPHBState *VAR_1,
PCIDevice *VAR_2,
Error **VAR_3)
{ sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(VAR_0); DeviceState *dev = DEVICE(VAR_2); int VAR_4 = drck->get_index(VAR_0); void *VAR_5 = NULL; int VAR_6 = 0, VAR_7; if (dev->hotplugged) { VAR_5 = create_device_tree(&VAR_7); VAR_6 = spapr_create_pci_child_dt(VAR_1, VAR_2,
VAR_4, NULL,
VAR_5, 0); if (!VAR_6) { error_setg(VAR_3, "Failed to create pci child device tree node"); goto out; } } drck->attach(VAR_0, DEVICE(VAR_2),
VAR_5, VAR_6, !dev->hotplugged, VAR_3); out:
if (*VAR_3) { g_free(VAR_5); } }