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>
This commit is contained in:
parent
bf298f83c3
commit
81bf96d3d2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user