diff options
-rw-r--r-- | hw/qdev-properties-system.c | 6 | ||||
-rw-r--r-- | qemu-char.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/hw/qdev-properties-system.c b/hw/qdev-properties-system.c index 28813d3978..d9934b5b9c 100644 --- a/hw/qdev-properties-system.c +++ b/hw/qdev-properties-system.c @@ -136,9 +136,11 @@ static void release_chr(Object *obj, const char *name, void *opaque) 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 bab2eb7a9a..ca9381bc0c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -224,8 +224,6 @@ void qemu_chr_add_handlers(CharDriverState *s, 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; |