mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 21:33:40 +08:00
mips: use object_new() instead of gnew()+object_initialize()
object_initialize() is intended for inplace initialization of objects, but here it's first allocated with g_new0() and then initialized with object_initialize(). QEMU already has API to do this (object_new), so do object creation with suitable for usecase API. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1507211474-188400-36-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
e9135ab399
commit
81491c2846
@ -460,7 +460,6 @@ static void boston_mach_init(MachineState *machine)
|
||||
|
||||
s = BOSTON(dev);
|
||||
s->mach = machine;
|
||||
s->cps = g_new0(MIPSCPSState, 1);
|
||||
|
||||
if (!cpu_supports_cps_smp(cpu_model)) {
|
||||
error_report("Boston requires CPUs which support CPS");
|
||||
@ -469,7 +468,7 @@ static void boston_mach_init(MachineState *machine)
|
||||
|
||||
is_64b = cpu_supports_isa(cpu_model, ISA_MIPS64);
|
||||
|
||||
object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
|
||||
s->cps = MIPS_CPS(object_new(TYPE_MIPS_CPS));
|
||||
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
|
||||
|
||||
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
|
||||
|
@ -949,9 +949,8 @@ static void create_cps(MaltaState *s, const char *cpu_model,
|
||||
qemu_irq *cbus_irq, qemu_irq *i8259_irq)
|
||||
{
|
||||
Error *err = NULL;
|
||||
s->cps = g_new0(MIPSCPSState, 1);
|
||||
|
||||
object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
|
||||
s->cps = MIPS_CPS(object_new(TYPE_MIPS_CPS));
|
||||
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
|
||||
|
||||
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
|
||||
|
Loading…
Reference in New Issue
Block a user