mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
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
1 changed files with 5 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue