]> Git Repo - qemu.git/commitdiff
mips: use object_new() instead of gnew()+object_initialize()
authorIgor Mammedov <[email protected]>
Thu, 5 Oct 2017 13:51:09 +0000 (15:51 +0200)
committerEduardo Habkost <[email protected]>
Fri, 27 Oct 2017 14:04:28 +0000 (16:04 +0200)
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 <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <1507211474[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
hw/mips/boston.c
hw/mips/mips_malta.c

index 776ee283e15865c2241a9e36b8790613b46ec798..e815be6a6c98e0aa74e19ae1c1df5b807f72f2a3 100644 (file)
@@ -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);
index 2adb9bcf89dbf712875bed01cb6a70df90f4aea3..b6a58c7f21ebc570d62548e94ba8ec5b4ee63a5c 100644 (file)
@@ -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);
This page took 0.031295 seconds and 4 git commands to generate.