usb-serial: Fail instead of crash when chardev is missing
PATCH 1/1 usb-serial: Fail instead of crash when chardev is missing
Signed-off-by Markus Armbruster <[email protected]>
--- hw/usb-serial.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
hw/usb-serial.c +5 -0
@@ -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);
Signature · 1 line
1.6.6.1
Quoted 2 lines · Markus Armbruster
Signed-off-by Markus Armbruster<[email protected]>
Nice catch.
Acked-by Gerd Hoffmann <[email protected]>
cheers,
Gerd
Aurelien Jarno
AppliedQuoted 5 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- hw/usb-serial.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Thanks, applied.
Quoted 21 lines
hw/usb-serial.c +5
-0@@ -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);Signature · 1 line
1.6.6.1
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net