aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/usb-serial.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 5b2483ab44..c19580f305 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -545,6 +545,11 @@ static int usb_serial_initfn(USBDevice *dev)
USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev);
s->dev.speed = USB_SPEED_FULL;
+ if (!s->cs) {
+ error_report("Property chardev is required");
+ return -1;
+ }
+
qemu_chr_add_handlers(s->cs, usb_serial_can_read, usb_serial_read,
usb_serial_event, s);
usb_serial_handle_reset(dev);