From 09d560177101d2ef1e333754a25cfa49b70583b3 Mon Sep 17 00:00:00 2001 From: Jun Li Date: Wed, 5 Nov 2014 15:03:03 +0800 Subject: qdev: Avoid type assertion in qdev_build_hotpluggable_device_list() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently when *obj is not a TYPE_DEVICE, QEMU will abort. This patch fixes it. When *obj is not a TYPE_DEVICE, just do not add it to hotpluggable device list. This patch also fixes the following issue: 1. boot QEMU using cli: $ /opt/qemu-git-arm/bin/qemu-system-x86_64 -monitor stdio -enable-kvm \ -device virtio-scsi-pci,id=scsi0 2. device_del scsi0 via hmp using tab key(first input device_del, then press "Tab" key). (qemu) device_del After step 2, QEMU will abort. (qemu) device_del hw/core/qdev.c:930:qdev_build_hotpluggable_device_list: Object 0x5555563a2460 is not an instance of type device Signed-off-by: Jun Li Reviewed-by: Paolo Bonzini Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber --- hw/core/qdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 2eacac0787..ff81f675da 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -988,7 +988,12 @@ void qdev_alias_all_properties(DeviceState *target, Object *source) static int qdev_add_hotpluggable_device(Object *obj, void *opaque) { GSList **list = opaque; - DeviceState *dev = DEVICE(obj); + DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj), + TYPE_DEVICE); + + if (dev == NULL) { + return 0; + } if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { *list = g_slist_append(*list, dev); -- cgit v1.2.3 From f824e8ed03cfcda55531206b2ee6fce62a7206f3 Mon Sep 17 00:00:00 2001 From: Zhoujian Date: Thu, 12 Feb 2015 15:43:02 +0800 Subject: qom: Fix typo, 'my_class_init' -> 'derived_class_init' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhoujian Signed-off-by: Gonglei Signed-off-by: Andreas Färber --- include/qom/object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qom/object.h b/include/qom/object.h index 89c3092967..87575735fe 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -273,7 +273,7 @@ typedef struct InterfaceInfo InterfaceInfo; * .name = TYPE_DERIVED, * .parent = TYPE_MY, * .class_size = sizeof(DerivedClass), - * .class_init = my_class_init, + * .class_init = derived_class_init, * }; * * -- cgit v1.2.3 From c4bacafb717de55538311b80a185ce9166b8daa2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:01 +0100 Subject: qdev: Improve qdev_init_nofail()'s error reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We get two error messages: a specific one from qdev_init(), and a generic one from qdev_init_nofail(). The specific one gets suppressed in QMP context. qdev_init_nofail() failing there is a bug, though. Cut out the qdev_init() middle-man: realize the device, and on error exit with a single error message. Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/core/qdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ff81f675da..10bf086a0a 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -373,10 +373,15 @@ void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev, way is somewhat unclean, and best avoided. */ void qdev_init_nofail(DeviceState *dev) { - const char *typename = object_get_typename(OBJECT(dev)); + Error *err = NULL; + + assert(!dev->realized); - if (qdev_init(dev) < 0) { - error_report("Initialization of device %s failed", typename); + object_property_set_bool(OBJECT(dev), true, "realized", &err); + if (err) { + error_report("Initialization of device %s failed: %s", + object_get_typename(OBJECT(dev)), + error_get_pretty(err)); exit(1); } } -- cgit v1.2.3 From e25b89e5208564220b9ea3a728f899b37ff6dc2d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:02 +0100 Subject: ide/isa: Replace unchecked qdev_init() by qdev_init_nofail() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isa_ide_init()'s callers don't check for failure. isa_ide_init() looks like it could fail, but since isa_ide_realizefn() can't fail, it actually can't. Replace its qdev_init() by qdev_init_nofail() to make it obvious. Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/ide/isa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ide/isa.c b/hw/ide/isa.c index b084162ddc..c0c4e1b098 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -88,9 +88,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, qdev_prop_set_uint32(dev, "iobase", iobase); qdev_prop_set_uint32(dev, "iobase2", iobase2); qdev_prop_set_uint32(dev, "irq", isairq); - if (qdev_init(dev) < 0) { - return NULL; - } + qdev_init_nofail(dev); s = ISA_IDE(dev); if (hd0) { -- cgit v1.2.3 From cd7c50a48dd484637aec36c351728ad0f140805a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:03 +0100 Subject: leon3: Replace unchecked qdev_init() by qdev_init_nofail() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grlib_irqmp_create(), grlib_gptimer_create() and grlib_apbuart_create() are helpers to create and realize GRLIB devices. Their only caller leon3_generic_hw_init() doesn't check for failure. Only the first can actually fail, and only when the caller fails to set up a pointer property, which is a programming error. Replace qdev_init() by qdev_init_nofail(). Signed-off-by: Markus Armbruster Reviewed-by: Fabien Chouteau Signed-off-by: Andreas Färber --- include/hw/sparc/grlib.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/hw/sparc/grlib.h b/include/hw/sparc/grlib.h index 470ce72250..9a0db7b47b 100644 --- a/include/hw/sparc/grlib.h +++ b/include/hw/sparc/grlib.h @@ -55,9 +55,7 @@ DeviceState *grlib_irqmp_create(hwaddr base, qdev_prop_set_ptr(dev, "set_pil_in", set_pil_in); qdev_prop_set_ptr(dev, "set_pil_in_opaque", env); - if (qdev_init(dev)) { - return NULL; - } + qdev_init_nofail(dev); env->irq_manager = dev; @@ -87,9 +85,7 @@ DeviceState *grlib_gptimer_create(hwaddr base, qdev_prop_set_uint32(dev, "frequency", freq); qdev_prop_set_uint32(dev, "irq-line", base_irq); - if (qdev_init(dev)) { - return NULL; - } + qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); @@ -112,9 +108,7 @@ DeviceState *grlib_apbuart_create(hwaddr base, dev = qdev_create(NULL, "grlib,apbuart"); qdev_prop_set_chr(dev, "chrdev", serial); - if (qdev_init(dev)) { - return NULL; - } + qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); -- cgit v1.2.3 From aef0d55a4bc52b1713de88c100ba6dc451578e50 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:04 +0100 Subject: etsec: Replace qdev_init() by qdev_init_nofail() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit etsec_create() is a helper to create and realize the eTSEC. It's currently unused. Similar helpers for other NICs use qdev_init_nofail(). Match that. Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/net/fsl_etsec/etsec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 2fbbc6ccc0..c57365fdec 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -443,10 +443,7 @@ DeviceState *etsec_create(hwaddr base, dev = qdev_create(NULL, "eTSEC"); qdev_set_nic_properties(dev, nd); - - if (qdev_init(dev)) { - return NULL; - } + qdev_init_nofail(dev); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, tx_irq); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, rx_irq); -- cgit v1.2.3 From b6607a1a204d52fe13746cc9c3d2da4303e39b18 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:05 +0100 Subject: serial: Factor out common serial_hds_isa_init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's the same old loop copied five times, plus another instance where it's clipped to two iterations and unrolled. No external users of serial_isa_init() are left, so give it internal linkage. Maintainers of affected machines cc'ed. Cc: Richard Henderson Cc: Anthony Liguori Cc: "Michael S. Tsirkin" Cc: Aurelien Jarno Cc: Leon Alrae Cc: Blue Swirl Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/alpha/dp264.c | 6 +----- hw/char/serial-isa.c | 15 ++++++++++++++- hw/i386/pc.c | 6 +----- hw/mips/mips_fulong2e.c | 7 +------ hw/mips/mips_malta.c | 3 +-- hw/mips/mips_r4k.c | 6 +----- hw/sparc64/sun4u.c | 7 ++----- include/hw/char/serial.h | 2 +- 8 files changed, 22 insertions(+), 30 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 84a55e41a2..e82d61d28c 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -83,11 +83,7 @@ static void clipper_init(MachineState *machine) pci_vga_init(pci_bus); /* Serial code setup. */ - for (i = 0; i < MAX_SERIAL_PORTS; ++i) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); /* Network setup. e1000 is good enough, failing Tulip support. */ for (i = 0; i < nb_nics; i++) { diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index c9fcb2761f..059ceb8b5f 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -119,7 +119,7 @@ static void serial_register_types(void) type_init(serial_register_types) -bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) +static bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; @@ -136,3 +136,16 @@ bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) } return true; } + +void serial_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <= MAX_SERIAL_PORTS); + + for (i = 0; i < n; ++i) { + if (serial_hds[i]) { + serial_isa_init(bus, i, serial_hds[i]); + } + } +} diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c7af6aae01..18ed2634f3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1419,11 +1419,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, pcspk_init(isa_bus, pit); } - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 6a9ebfa911..bebf7defbe 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -277,7 +277,6 @@ static void mips_fulong2e_init(MachineState *machine) PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; - int i; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; @@ -384,11 +383,7 @@ static void mips_fulong2e_init(MachineState *machine) rtc_init(isa_bus, 2000, NULL); - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); if (parallel_hds[0]) { parallel_init(isa_bus, 0, parallel_hds[0]); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5845158a74..e57f78c1e5 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1172,8 +1172,7 @@ void mips_malta_init(MachineState *machine) isa_create_simple(isa_bus, "i8042"); rtc_init(isa_bus, 2000, NULL); - serial_isa_init(isa_bus, 0, serial_hds[0]); - serial_isa_init(isa_bus, 1, serial_hds[1]); + serial_hds_isa_init(isa_bus, 2); if (parallel_hds[0]) parallel_init(isa_bus, 0, parallel_hds[0]); for(i = 0; i < MAX_FD; i++) { diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index a7fe0ceadf..1698f2def2 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -283,11 +283,7 @@ void mips_r4k_init(MachineState *machine) pit = pit_init(isa_bus, 0x40, 0, NULL); - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); isa_vga_init(isa_bus); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 3ff5bd8871..082b8e0eb3 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -849,11 +849,8 @@ static void sun4uv_init(MemoryRegion *address_space_mem, NULL, 115200, serial_hds[i], DEVICE_BIG_ENDIAN); i++; } - for(; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(isa_bus, i, serial_hds[i]); - } - } + + serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); for(i = 0; i < MAX_PARALLEL_PORTS; i++) { if (parallel_hds[i]) { diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index f431764bf5..15beb6b45c 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -92,6 +92,6 @@ SerialState *serial_mm_init(MemoryRegion *address_space, /* serial-isa.c */ #define TYPE_ISA_SERIAL "isa-serial" -bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr); +void serial_hds_isa_init(ISABus *bus, int n); #endif -- cgit v1.2.3 From c6f10a5876a81f7a016714df06730c48210ee419 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:06 +0100 Subject: serial: serial_hds_isa_init() shouldn't fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It shouldn't fail, and no caller checks for failure. Make failure fatal. Maintainers of affected machines cc'ed. Cc: Richard Henderson Cc: Anthony Liguori Cc: "Michael S. Tsirkin" Cc: Aurelien Jarno Cc: Leon Alrae Cc: Blue Swirl Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/char/serial-isa.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 059ceb8b5f..f3db024d06 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -119,22 +119,16 @@ static void serial_register_types(void) type_init(serial_register_types) -static bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) +static void serial_isa_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; - isadev = isa_try_create(bus, TYPE_ISA_SERIAL); - if (!isadev) { - return false; - } + isadev = isa_create(bus, TYPE_ISA_SERIAL); dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); - if (qdev_init(dev) < 0) { - return false; - } - return true; + qdev_init_nofail(dev); } void serial_hds_isa_init(ISABus *bus, int n) -- cgit v1.2.3 From 07dc788054d714a07df08e2eacc8c2e1c47b9a58 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:07 +0100 Subject: parallel: Factor out common parallel_hds_isa_init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maintainers of affected machines cc'ed. Cc: Anthony Liguori Cc: "Michael S. Tsirkin" Cc: Aurelien Jarno Cc: Leon Alrae Cc: Blue Swirl Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/char/parallel.c | 31 +++++++++++++++++++++++++++++++ hw/i386/pc.c | 7 +------ hw/mips/mips_fulong2e.c | 5 +---- hw/mips/mips_malta.c | 4 ++-- hw/sparc64/sun4u.c | 7 +------ include/hw/i386/pc.h | 17 +---------------- 6 files changed, 37 insertions(+), 34 deletions(-) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index c2b553f0d1..710cefcd94 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -641,3 +641,34 @@ static void parallel_register_types(void) } type_init(parallel_register_types) + +static bool parallel_init(ISABus *bus, int index, CharDriverState *chr) +{ + DeviceState *dev; + ISADevice *isadev; + + isadev = isa_try_create(bus, "isa-parallel"); + if (!isadev) { + return false; + } + dev = DEVICE(isadev); + qdev_prop_set_uint32(dev, "index", index); + qdev_prop_set_chr(dev, "chardev", chr); + if (qdev_init(dev) < 0) { + return false; + } + return true; +} + +void parallel_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <= MAX_PARALLEL_PORTS); + + for (i = 0; i < n; i++) { + if (parallel_hds[i]) { + parallel_init(bus, i, parallel_hds[i]); + } + } +} diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 18ed2634f3..ed623e1090 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1420,12 +1420,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, } serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(isa_bus, i, parallel_hds[i]); - } - } + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); i8042 = isa_create_simple(isa_bus, "i8042"); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index bebf7defbe..ea73585a92 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -384,10 +384,7 @@ static void mips_fulong2e_init(MachineState *machine) rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); - - if (parallel_hds[0]) { - parallel_init(isa_bus, 0, parallel_hds[0]); - } + parallel_hds_isa_init(isa_bus, 1); /* Sound card */ audio_init(pci_bus); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index e57f78c1e5..533b2e60fe 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1173,8 +1173,8 @@ void mips_malta_init(MachineState *machine) rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 2); - if (parallel_hds[0]) - parallel_init(isa_bus, 0, parallel_hds[0]); + parallel_hds_isa_init(isa_bus, 1); + for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 082b8e0eb3..17cf61f720 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -851,12 +851,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, } serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS); - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(isa_bus, i, parallel_hds[i]); - } - } + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); for(i = 0; i < nb_nics; i++) pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 69d9cf8e67..8ba84d3ee0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -107,23 +107,8 @@ struct PcGuestInfo { }; /* parallel.c */ -static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr) -{ - DeviceState *dev; - ISADevice *isadev; - isadev = isa_try_create(bus, "isa-parallel"); - if (!isadev) { - return false; - } - dev = DEVICE(isadev); - qdev_prop_set_uint32(dev, "index", index); - qdev_prop_set_chr(dev, "chardev", chr); - if (qdev_init(dev) < 0) { - return false; - } - return true; -} +void parallel_hds_isa_init(ISABus *bus, int n); bool parallel_mm_init(MemoryRegion *address_space, hwaddr base, int it_shift, qemu_irq irq, -- cgit v1.2.3 From 4bc6a3e54e06c47b8e23bfa3d873fa2f42dfec02 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 4 Feb 2015 18:33:08 +0100 Subject: parallel: parallel_hds_isa_init() shouldn't fail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It shouldn't fail, and no caller checks for failure. Make failure fatal. Maintainers of affected machines cc'ed. Cc: Anthony Liguori Cc: "Michael S. Tsirkin" Cc: Aurelien Jarno Cc: Leon Alrae Cc: Blue Swirl Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- hw/char/parallel.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 710cefcd94..4079554bb9 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -642,22 +642,16 @@ static void parallel_register_types(void) type_init(parallel_register_types) -static bool parallel_init(ISABus *bus, int index, CharDriverState *chr) +static void parallel_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; - isadev = isa_try_create(bus, "isa-parallel"); - if (!isadev) { - return false; - } + isadev = isa_create(bus, "isa-parallel"); dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); - if (qdev_init(dev) < 0) { - return false; - } - return true; + qdev_init_nofail(dev); } void parallel_hds_isa_init(ISABus *bus, int n) -- cgit v1.2.3