static int xen_pt_config_reg_init(XenPCIPassthroughState *s,

                                  XenPTRegGroup *reg_grp, XenPTRegInfo *reg)

{

    XenPTReg *reg_entry;

    uint32_t data = 0;

    int rc = 0;



    reg_entry = g_new0(XenPTReg, 1);

    reg_entry->reg = reg;



    if (reg->init) {

        /* initialize emulate register */

        rc = reg->init(s, reg_entry->reg,

                       reg_grp->base_offset + reg->offset, &data);

        if (rc < 0) {

            free(reg_entry);

            return rc;

        }

        if (data == XEN_PT_INVALID_REG) {

            /* free unused BAR register entry */

            free(reg_entry);

            return 0;

        }

        /* set register value */

        reg_entry->data = data;

    }

    /* list add register entry */

    QLIST_INSERT_HEAD(&reg_grp->reg_tbl_list, reg_entry, entries);



    return 0;

}

static int xen_pt_config_reg_init(XenPCIPassthroughState *s,

                                  XenPTRegGroup *reg_grp, XenPTRegInfo *reg)

{

    XenPTReg *reg_entry;

    uint32_t data = 0;

    int rc = 0;



    reg_entry = g_new0(XenPTReg, 1);

    reg_entry->reg = reg;



    if (reg->init) {

        

        rc = reg->init(s, reg_entry->reg,

                       reg_grp->base_offset + reg->offset, &data);

        if (rc < 0) {

            free(reg_entry);

            return rc;

        }

        if (data == XEN_PT_INVALID_REG) {

            

            free(reg_entry);

            return 0;

        }

        

        reg_entry->data = data;

    }

    

    QLIST_INSERT_HEAD(&reg_grp->reg_tbl_list, reg_entry, entries);



    return 0;

}

            free(reg_entry);             free(reg_entry);
static int FUNC_0(XenPCIPassthroughState *VAR_0,

                                  XenPTRegGroup *VAR_1, XenPTRegInfo *VAR_2)

{

    XenPTReg *reg_entry;

    uint32_t data = 0;

    int VAR_3 = 0;



    reg_entry = g_new0(XenPTReg, 1);

    reg_entry->VAR_2 = VAR_2;



    if (VAR_2->init) {

        

        VAR_3 = VAR_2->init(VAR_0, reg_entry->VAR_2,

                       VAR_1->base_offset + VAR_2->offset, &data);

        if (VAR_3 < 0) {

            free(reg_entry);

            return VAR_3;

        }

        if (data == XEN_PT_INVALID_REG) {

            

            free(reg_entry);

            return 0;

        }

        

        reg_entry->data = data;

    }

    

    QLIST_INSERT_HEAD(&VAR_1->reg_tbl_list, reg_entry, entries);



    return 0;

}

static int FUNC_0(XenPCIPassthroughState *VAR_0,
XenPTRegGroup *VAR_1, XenPTRegInfo *VAR_2)
{ XenPTReg *reg_entry; uint32_t data = 0; int VAR_3 = 0; reg_entry = g_new0(XenPTReg, 1); reg_entry->VAR_2 = VAR_2; if (VAR_2->init) { VAR_3 = VAR_2->init(VAR_0, reg_entry->VAR_2,
VAR_1->base_offset + VAR_2->offset, &data); if (VAR_3 < 0) { free(reg_entry); return VAR_3; } if (data == XEN_PT_INVALID_REG) { free(reg_entry); return 0; } reg_entry->data = data; } QLIST_INSERT_HEAD(&VAR_1->reg_tbl_list, reg_entry, entries); return 0; }