qemu-char: Move incrementing of avail_connections to qdev-properties-system The decrement of avail_connections is done in qdev-properties-system move the increment there too for proper balancing of the calls. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364292483-16564-8-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/hw/qdev-properties-system.c b/hw/qdev-properties-system.c index 28813d3..d9934b5 100644 --- a/hw/qdev-properties-system.c +++ b/hw/qdev-properties-system.c
@@ -136,9 +136,11 @@ DeviceState *dev = DEVICE(obj); Property *prop = opaque; CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); + CharDriverState *chr = *ptr; - if (*ptr) { - qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL); + if (chr) { + qemu_chr_add_handlers(chr, NULL, NULL, NULL, NULL); + ++chr->avail_connections; } }
diff --git a/qemu-char.c b/qemu-char.c index bab2eb7..ca9381b 100644 --- a/qemu-char.c +++ b/qemu-char.c
@@ -224,8 +224,6 @@ int fe_open; if (!opaque && !fd_can_read && !fd_read && !fd_event) { - /* chr driver being released. */ - ++s->avail_connections; fe_open = 0; } else { fe_open = 1;