From 9d989c732b153fe1576adbddb9879313a24d3cd2 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Mon, 9 May 2016 18:44:00 +0200 Subject: [PATCH 1/2] target-mips: fix call to memset in soft reset code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent versions of GCC report the following error when compiling target-mips/helper.c: qemu/target-mips/helper.c:542:9: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] This is indeed correct and due to a wrong usage of sizeof(). Fix that. Cc: Stefan Weil Cc: Leon Alrae Cc: qemu-stable@nongnu.org LP: https://bugs.launchpad.net/qemu/+bug/1577841 Signed-off-by: Aurelien Jarno Reviewed-by: Stefan Weil Reviewed-by: Leon Alrae Signed-off-by: Leon Alrae --- target-mips/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-mips/helper.c b/target-mips/helper.c index 1004edee05..cfea177ee5 100644 --- a/target-mips/helper.c +++ b/target-mips/helper.c @@ -539,7 +539,7 @@ void mips_cpu_do_interrupt(CPUState *cs) break; case EXCP_SRESET: env->CP0_Status |= (1 << CP0St_SR); - memset(env->CP0_WatchLo, 0, sizeof(*env->CP0_WatchLo)); + memset(env->CP0_WatchLo, 0, sizeof(env->CP0_WatchLo)); goto set_error_EPC; case EXCP_NMI: env->CP0_Status |= (1 << CP0St_NMI); From 7fe91a5b33fe100bbc68ee434f947752c69b3f68 Mon Sep 17 00:00:00 2001 From: "xiaoqiang.zhao" Date: Thu, 5 May 2016 11:04:46 +0800 Subject: [PATCH 2/2] hw/display: QOM'ify jazz_led.c * Drop the old SysBus init function and use instance_init * Move graphic_console_init into realize stage Signed-off-by: xiaoqiang zhao Reviewed-by: Peter Maydell Signed-off-by: Leon Alrae --- hw/display/jazz_led.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 09dcdb46a3..b72fdb1717 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -267,16 +267,20 @@ static const GraphicHwOps jazz_led_ops = { .text_update = jazz_led_text_update, }; -static int jazz_led_init(SysBusDevice *dev) +static void jazz_led_init(Object *obj) +{ + LedState *s = JAZZ_LED(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); + + memory_region_init_io(&s->iomem, obj, &led_ops, s, "led", 1); + sysbus_init_mmio(dev, &s->iomem); +} + +static void jazz_led_realize(DeviceState *dev, Error **errp) { LedState *s = JAZZ_LED(dev); - memory_region_init_io(&s->iomem, OBJECT(s), &led_ops, s, "led", 1); - sysbus_init_mmio(dev, &s->iomem); - - s->con = graphic_console_init(DEVICE(dev), 0, &jazz_led_ops, s); - - return 0; + s->con = graphic_console_init(dev, 0, &jazz_led_ops, s); } static void jazz_led_reset(DeviceState *d) @@ -291,18 +295,18 @@ static void jazz_led_reset(DeviceState *d) static void jazz_led_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = jazz_led_init; dc->desc = "Jazz LED display", dc->vmsd = &vmstate_jazz_led; dc->reset = jazz_led_reset; + dc->realize = jazz_led_realize; } static const TypeInfo jazz_led_info = { .name = TYPE_JAZZ_LED, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LedState), + .instance_init = jazz_led_init, .class_init = jazz_led_class_init, };