aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-05-28 17:03:22 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-06-30 20:35:46 +0200
commit81bf96d3d299a7f88bf3e2ece4f795a9949db5f7 (patch)
tree4dd5d7a384300aa0b45cd8e7b1ec1afd87852562 /hw
parentbf298f83c35da854632c5be75733a4aa95a780bf (diff)
usb-serial: Fail instead of crash when chardev is missing
Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw')
-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);