Revision 494c2717 hw/intc/apic_common.c

b/hw/intc/apic_common.c
284 284
    return 0;
285 285
}
286 286

  
287
static int apic_init_common(ICCDevice *dev)
287
static void apic_common_realize(DeviceState *dev, Error **errp)
288 288
{
289 289
    APICCommonState *s = APIC_COMMON(dev);
290 290
    APICCommonClass *info;
......
293 293
    static bool mmio_registered;
294 294

  
295 295
    if (apic_no >= MAX_APICS) {
296
        return -1;
296
        error_setg(errp, "%s initialization failed.",
297
                   object_get_typename(OBJECT(dev)));
298
        return;
297 299
    }
298 300
    s->idx = apic_no++;
299 301

  
300 302
    info = APIC_COMMON_GET_CLASS(s);
301
    info->realize(DEVICE(dev), NULL);
303
    info->realize(dev, errp);
302 304
    if (!mmio_registered) {
303
        ICCBus *b = ICC_BUS(qdev_get_parent_bus(DEVICE(dev)));
305
        ICCBus *b = ICC_BUS(qdev_get_parent_bus(dev));
304 306
        memory_region_add_subregion(b->apic_address_space, 0, &s->io_memory);
305 307
        mmio_registered = true;
306 308
    }
......
315 317
        info->enable_tpr_reporting(s, true);
316 318
    }
317 319

  
318
    return 0;
319 320
}
320 321

  
321 322
static void apic_dispatch_pre_save(void *opaque)
......
387 388
    dc->vmsd = &vmstate_apic_common;
388 389
    dc->reset = apic_reset_common;
389 390
    dc->props = apic_properties_common;
390
    idc->init = apic_init_common;
391
    idc->realize = apic_common_realize;
391 392
    /*
392 393
     * Reason: APIC and CPU need to be wired up by
393 394
     * x86_cpu_apic_create()

Also available in: Unified diff