From bc19fcaa1b6d2a89b96793c7e8890978fc477f51 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Thu, 13 Aug 2009 16:26:52 +0000 Subject: Unbreak Sparc32 and PPC Convert qdev ptr type to chr, allow a NULL pointer. Signed-off-by: Blue Swirl --- hw/escc.c | 8 ++++---- hw/qdev-properties.c | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'hw') diff --git a/hw/escc.c b/hw/escc.c index 74a96cd6cb..031dae3ec8 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -737,8 +737,8 @@ int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", clock); qdev_prop_set_uint32(dev, "it_shift", it_shift); - qdev_prop_set_ptr(dev, "chrB", chrB); - qdev_prop_set_ptr(dev, "chrA", chrA); + qdev_prop_set_chr(dev, "chrB", chrB); + qdev_prop_set_chr(dev, "chrA", chrA); qdev_prop_set_uint32(dev, "chnBtype", ser); qdev_prop_set_uint32(dev, "chnAtype", ser); qdev_init(dev); @@ -900,8 +900,8 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq, qdev_prop_set_uint32(dev, "disabled", disabled); qdev_prop_set_uint32(dev, "frequency", clock); qdev_prop_set_uint32(dev, "it_shift", it_shift); - qdev_prop_set_ptr(dev, "chrB", NULL); - qdev_prop_set_ptr(dev, "chrA", NULL); + qdev_prop_set_chr(dev, "chrB", NULL); + qdev_prop_set_chr(dev, "chrA", NULL); qdev_prop_set_uint32(dev, "chnBtype", mouse); qdev_prop_set_uint32(dev, "chnAtype", kbd); qdev_init(dev); diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index df3d20902a..c9703c261c 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -173,7 +173,12 @@ PropertyInfo qdev_prop_drive = { static int print_chr(DeviceState *dev, Property *prop, char *dest, size_t len) { CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); - return snprintf(dest, len, "%s", (*ptr)->label); + + if (*ptr && (*ptr)->label) { + return snprintf(dest, len, "%s", (*ptr)->label); + } else { + return snprintf(dest, len, ""); + } } PropertyInfo qdev_prop_chr = { -- cgit v1.2.3