From 81491c2846b7a818eb069dbc5f688537e382fc83 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 5 Oct 2017 15:51:09 +0200 Subject: mips: use object_new() instead of gnew()+object_initialize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <1507211474-188400-36-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- hw/mips/mips_malta.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'hw/mips/mips_malta.c') diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 2adb9bcf89..b6a58c7f21 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -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); -- cgit v1.2.3